Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 56 lines (50 sloc) 1.087 kB
894acc6 @ingydotnet Checking in hacking with ashleydev...
authored
1 use v6;
2
3 grammar Grammar1 {
4 regex ANY { . }
5 regex SPACE { <[\ \t]> }
6 regex BREAK { \n }
7 regex EOL { \r? \n }
8 regex NON_BREAK { \N }
9 regex NON_SPACE_BREAK
10 { <![\ \n]> }
11 regex LOWER { <[a..z]> }
12 regex UPPER { <[A..Z]> }
13 regex ALPHANUM { <[A..Za..z0..9]> }
14 regex WORD { <[A..Za..z0..9_]> }
15 regex DIGIT { <[0..9]> }
16 regex STAR { '*' }
17 regex DOT { '.' }
18 regex HASH { '#' }
19 regex BACK { '\\' }
20 regex SINGLE { "'" }
21 regex DOUBLE { '"' }
22 regex ESCAPE { <[0nt]> }
23
24 regex TOP {
25 <equation>
26 }
27 regex equation {
28 <lvalue>
29 <SPACE>+
30 <assignment>
31 <SPACE>+
32 <operand>
33 <SPACE>+
34 <operator>
35 <SPACE>+
36 <operand>
37 <SPACE>+
38 <ending>
39 <SPACE>*
40 <EOS>
41 }
42 regex operand {
43 <number> | <quoted_string> | <variable>
44 }
45 regex lvalue { <WORD>+ }
46 regex ending { ; }
47 }
48
49 class Actions {
50 }
51
52 my $text = "$foo = $bar + 'O HAI';\n";
53
54 my $match = Grammar1.parse($testml, :actions(Actions));
55 say $match.perl;
Something went wrong with that request. Please try again.