1
2
3
4
5
6 [hpp]#include <cpp2cm/cpp2cm/Args.hpp>
7 [cpp]#include <soulng/lexer/TrivialLexer.hpp>
8 [cpp]#include <soulng/parser/Range.hpp>
9
10 using namespace soulng::lexer;
11
12 parser ArgsParser
13 {
14 uselexer TrivialLexer;
15 main;
16
17 Args(std::vector* args)
18 ::= '(' (Arg:arg{ args->push_back(arg); } % ',') ')'
19 ;
20
21 Arg(var Span s) : int
22 ::= S:s? ("[0-9]"{ s = span; } ("[0-9]"{ s.end = span.end; })* S:s?)
23 {
24 return ParseInt(lexer.GetMatch(s));
25 }
26 ;
27
28 S
29 ::= "[ \t]"+
30 ;
31 }