factor: trim more whitespace from #! comments
parent
4ec2311406
commit
9fb130791b
|
@ -254,20 +254,20 @@ IN: peg.ebnf.tests
|
|||
] must-fail
|
||||
|
||||
{ V{ V{ 49 } "+" V{ 49 } } } [
|
||||
#! Test direct left recursion.
|
||||
#! Using packrat, so first part of expr fails, causing 2nd choice to be used
|
||||
#! Test direct left recursion.
|
||||
#! Using packrat, so first part of expr fails, causing 2nd choice to be used
|
||||
"1+1" [EBNF num=([0-9])+ expr=expr "+" num | num EBNF]
|
||||
] unit-test
|
||||
|
||||
{ V{ V{ V{ 49 } "+" V{ 49 } } "+" V{ 49 } } } [
|
||||
#! Test direct left recursion.
|
||||
#! Using packrat, so first part of expr fails, causing 2nd choice to be used
|
||||
#! Test direct left recursion.
|
||||
#! Using packrat, so first part of expr fails, causing 2nd choice to be used
|
||||
"1+1+1" [EBNF num=([0-9])+ expr=expr "+" num | num EBNF]
|
||||
] unit-test
|
||||
|
||||
{ V{ V{ V{ 49 } "+" V{ 49 } } "+" V{ 49 } } } [
|
||||
#! Test indirect left recursion.
|
||||
#! Using packrat, so first part of expr fails, causing 2nd choice to be used
|
||||
#! Test indirect left recursion.
|
||||
#! Using packrat, so first part of expr fails, causing 2nd choice to be used
|
||||
"1+1+1" [EBNF num=([0-9])+ x=expr expr=x "+" num | num EBNF]
|
||||
] unit-test
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ SYMBOL: serialized
|
|||
serialized get [ assoc-size swap ] keep set-at ;
|
||||
|
||||
: object-id ( obj -- id )
|
||||
#! Return the id of an already serialized object
|
||||
#! Return the id of an already serialized object
|
||||
serialized get at ;
|
||||
|
||||
! Numbers are serialized as follows:
|
||||
|
|
|
@ -5,16 +5,16 @@ peg peg.ebnf peg.javascript.ast peg.javascript.tokenizer ;
|
|||
IN: peg.javascript.parser
|
||||
|
||||
#! Grammar for JavaScript. Based on OMeta-JS example from:
|
||||
#! http://jarrett.cs.ucla.edu/ometa-js/#JavaScript_Compiler
|
||||
#! http://jarrett.cs.ucla.edu/ometa-js/#JavaScript_Compiler
|
||||
|
||||
#! The interesting thing about this parser is the mixing of
|
||||
#! a default and non-default tokenizer. The JavaScript tokenizer
|
||||
#! removes all newlines. So when operating on tokens there is no
|
||||
#! need for newline and space skipping in the grammar. But JavaScript
|
||||
#! uses the newline in the 'automatic semicolon insertion' rule.
|
||||
#! uses the newline in the 'automatic semicolon insertion' rule.
|
||||
#!
|
||||
#! If a statement ends in a newline, sometimes the semicolon can be
|
||||
#! skipped. So we define an 'nl' rule using the default tokenizer.
|
||||
#! skipped. So we define an 'nl' rule using the default tokenizer.
|
||||
#! This operates a character at a time. Using this 'nl' in the parser
|
||||
#! allows us to detect newlines when we need to for the semicolon
|
||||
#! insertion rule, but ignore it in all other places.
|
||||
|
|
|
@ -4,7 +4,7 @@ USING: kernel sequences strings arrays math.parser peg peg.ebnf peg.javascript.a
|
|||
IN: peg.javascript.tokenizer
|
||||
|
||||
#! Grammar for JavaScript. Based on OMeta-JS example from:
|
||||
#! http://jarrett.cs.ucla.edu/ometa-js/#JavaScript_Compiler
|
||||
#! http://jarrett.cs.ucla.edu/ometa-js/#JavaScript_Compiler
|
||||
|
||||
USE: prettyprint
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ CONSTANT: game-height 256
|
|||
color third index 2 + bitmap set-nth ;
|
||||
|
||||
: get-bitmap-pixel ( point array -- color )
|
||||
#! Point is a {x y}. color is a {r g b}
|
||||
#! Point is a {x y}. color is a {r g b}
|
||||
[ bitmap-index ] dip
|
||||
[ nth ]
|
||||
[ [ 1 + ] dip nth ]
|
||||
|
@ -164,7 +164,7 @@ M: space-invaders read-port
|
|||
#! Bit 1 = invaders sound 2
|
||||
#! Bit 2 = invaders sound 3
|
||||
#! Bit 3 = invaders sound 4
|
||||
#! Bit 4 = spaceship hit
|
||||
#! Bit 4 = spaceship hit
|
||||
#! Bit 5 = amplifier enabled/disabled
|
||||
2dup 0 port5-newly-set? [ dup SOUND-WALK1 play-invaders-sound ] when
|
||||
2dup 1 port5-newly-set? [ dup SOUND-WALK2 play-invaders-sound ] when
|
||||
|
@ -336,7 +336,7 @@ M: space-invaders update-video
|
|||
system:nano-count ;
|
||||
|
||||
: invaders-process ( micros gadget -- )
|
||||
#! Run a space invaders gadget inside a
|
||||
#! Run a space invaders gadget inside a
|
||||
#! concurrent process. Messages can be sent to
|
||||
#! signal key presses, etc.
|
||||
dup quit?>> [
|
||||
|
|
Loading…
Reference in New Issue