summaryrefslogtreecommitdiff
path: root/test/cases/colm.d/tcontext1.lm
blob: 55b8a323f86b3a201e13be3ca98788e424816c87 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

lex
	token tIDENTIFIER /[a-z][a-zA-Z_]*/ -ni
	ignore /[ \t\n]+/
	ignore comment /'#' [^\n]* '\n'/
end

lex
	ignore /[\t ]+/
	ignore /'#' [^\n]*/
	literal `;
	token NL /'\n'/
end

# Required whitespace, but newline is not allowed.
token ws_no_nl
	/[ \t]+ [^ \t\n]/
	{
		input->push( make_token( typeid<ws_no_nl>, input->pull(match_length-1) ) )
	}

def method_call
	[tIDENTIFIER ws_no_nl tIDENTIFIER `; NL]

parse R: method_call[stdin]

print( xml( R ) )
print( '\n' )

##### IN #####
a bc;
##### EXP #####
<method_call><tIDENTIFIER>a</tIDENTIFIER><ws_no_nl> </ws_no_nl><tIDENTIFIER>bc</tIDENTIFIER><_literal_000b>;</_literal_000b><NL>
</NL></method_call>