]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/peg-lexer/peg-lexer.factor
Delete empty unit tests files, remove 1- and 1+, reorder IN: lines in a lot of places...
[factor.git] / extra / peg-lexer / peg-lexer.factor
index eff0043ac373a9adcffc51ec78dd9aceb21ffc9e..dcde55c91ada82f2a6c696b928ebb2d58549a219 100644 (file)
@@ -11,8 +11,8 @@ CONSULT: assoc-protocol lex-hash hash>> ;
 
 :: prepare-pos ( v i -- c l )
     [let | n [ i v head-slice ] |
-           v CHAR: \n n last-index -1 or 1+ -
-           n [ CHAR: \n = ] count 1+
+           v CHAR: \n n last-index -1 or 1 + -
+           n [ CHAR: \n = ] count 1 +
     ] ;
       
 : store-pos ( v a -- )
@@ -25,12 +25,12 @@ M: lex-hash set-at
         [ swap hash>> set-at ]
     } case ;
 
-:: at-pos ( t l c -- p ) t l head-slice [ length ] map sum l 1- + c + ;
+:: at-pos ( t l c -- p ) t l head-slice [ length ] map sum l 1 - + c + ;
 
 M: lex-hash at*
     swap {
       { input [ drop lexer get text>> "\n" join t ] }
-      { pos [ drop lexer get [ text>> ] [ line>> 1- ] [ column>> 1+ ] tri at-pos t ] }
+      { pos [ drop lexer get [ text>> ] [ line>> 1 - ] [ column>> 1 + ] tri at-pos t ] }
       [ swap hash>> at* ]
     } case ;
 
@@ -61,4 +61,4 @@ space = " " | "\n" | "\t"
 spaces = space* => [[ drop ignore ]]
 chunk = (!(space) .)+ => [[ >string ]]
 expr = spaces chunk
-;EBNF
\ No newline at end of file
+;EBNF