blob: 86db7182ee56403a409d8718d749e0d36bca2457 (
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
35
|
##### LM #####
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>
|