meta_compile 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/bin/meta_compile +3 -3
- data/bootstrap/meta_for_ruby.txt +10 -10
- metadata +1 -1
data/bin/meta_compile
CHANGED
@@ -22,7 +22,7 @@ if @f
|
|
22
22
|
end
|
23
23
|
end while false
|
24
24
|
end
|
25
|
-
def
|
25
|
+
def compile_out
|
26
26
|
begin
|
27
27
|
@i.scan /\s*/; s='<'
|
28
28
|
@f = (@i.peek(s.length) == s) ? (@t=s; @i.pos += s.length) : nil
|
@@ -112,7 +112,7 @@ if @f
|
|
112
112
|
@o.print "\n"
|
113
113
|
end
|
114
114
|
break if @f
|
115
|
-
|
115
|
+
compile_out
|
116
116
|
if @f
|
117
117
|
@o.print 'if true'
|
118
118
|
@o.print "\n"
|
@@ -127,7 +127,7 @@ if @f
|
|
127
127
|
@o.print "\n"
|
128
128
|
end
|
129
129
|
break if @f
|
130
|
-
|
130
|
+
compile_out
|
131
131
|
if @f
|
132
132
|
end
|
133
133
|
end while false
|
data/bootstrap/meta_for_ruby.txt
CHANGED
@@ -1,22 +1,22 @@
|
|
1
1
|
.syntax RMetaII
|
2
2
|
|
3
|
-
arg = '$'
|
3
|
+
arg = '$' <'@o.print @t'>
|
4
4
|
| .string <'@o.print ' $>;
|
5
5
|
|
6
|
-
|
6
|
+
out = '<' *arg '>' <'@o.print "\n"'>;
|
7
7
|
|
8
|
-
exp3 = .id
|
9
|
-
| .string
|
10
|
-
|
11
|
-
| '.id'
|
8
|
+
exp3 = .id <'compile_' $>
|
9
|
+
| .string <'@i.scan /\s*/; s=' $>
|
10
|
+
<'@f = (@i.peek(s.length) == s) ? (@t=s; @i.pos += s.length) : nil'>
|
11
|
+
| '.id' <'@i.scan /\s*/; @f = @t = @i.scan /[A-Za-z]+[A-Za-z0-9_]+/'>
|
12
12
|
| '.string' <'@i.scan /\s*/; @f = @t = @i.scan /\047[^\047]*\047/'>
|
13
13
|
| '(' exp1 ')'
|
14
|
-
| '.e'
|
14
|
+
| '.e' <'@f = true'>
|
15
15
|
| '*' <'begin'> exp3 <'end while @f'> <'@f = true'>;
|
16
16
|
|
17
|
-
exp2 =
|
18
|
-
*(
|
19
|
-
|
17
|
+
exp2 = ( exp3 <'if @f'> | out <'if true'> )
|
18
|
+
*( exp3 <'raise("error at: " + @i.rest.split("\n")[0]) if !@f'>
|
19
|
+
| out ) <'end'>;
|
20
20
|
|
21
21
|
exp1 = <'begin'> exp2
|
22
22
|
*( '|' <'break if @f'> exp2 )
|