@@ -31,15 +31,6 @@ const hashSign = matchString("#", "hash sign");
3131const backtick = matchString ( "`" , "backtick" ) ;
3232const colon = matchString ( ":" , "colon" ) ;
3333
34- const tokiPonaWord = lex ( match ( / [ a - z ] [ a - z A - Z ] * / , "word" ) ) ;
35- const openParenthesis = lex ( matchString ( "(" , "open parenthesis" ) ) ;
36- const closeParenthesis = lex ( matchString ( ")" , "close parenthesis" ) ) ;
37- const openBracket = lex ( matchString ( "[" , "open bracket" ) ) ;
38- const closeBracket = lex ( matchString ( "]" , "close bracket" ) ) ;
39- const comma = lex ( matchString ( "," , "comma" ) ) ;
40- const semicolon = lex ( matchString ( ";" , "semicolon" ) ) ;
41- const slash = lex ( matchString ( "/" , "slash" ) ) ;
42-
4334const character = match ( / ./ u, "character" ) ;
4435const wordCharacter = match (
4536 new RegExp ( `[^${ escapeRegex ( RESERVED_SYMBOLS ) } ]` ) ,
@@ -62,6 +53,15 @@ const ignore = allWithCheck(
6253function lex < T > ( parser : Parser < T > ) : Parser < T > {
6354 return parser . skip ( ignore ) ;
6455}
56+ const tokiPonaWord = lex ( match ( / [ a - z ] [ a - z A - Z ] * / , "word" ) ) ;
57+ const openParenthesis = lex ( matchString ( "(" , "open parenthesis" ) ) ;
58+ const closeParenthesis = lex ( matchString ( ")" , "close parenthesis" ) ) ;
59+ const openBracket = lex ( matchString ( "[" , "open bracket" ) ) ;
60+ const closeBracket = lex ( matchString ( "]" , "close bracket" ) ) ;
61+ const comma = lex ( matchString ( "," , "comma" ) ) ;
62+ const semicolon = lex ( matchString ( ";" , "semicolon" ) ) ;
63+ const slash = lex ( matchString ( "/" , "slash" ) ) ;
64+
6565const keyword = memoize ( < T extends string > ( keyword : T ) =>
6666 lex ( withPosition ( match ( / [ a - z \- ] + / , `"${ keyword } "` ) ) )
6767 . map ( ( positioned ) =>
@@ -294,7 +294,7 @@ const prepositionDefinition = checkedSimpleUnitWithTemplate(
294294 . map ( ( preposition ) => ( { type : "preposition" , preposition } ) as const ) ;
295295const numeralDefinition = checkedSimpleUnit ( "num" )
296296 . mapWithPositionedError ( ( num ) => {
297- const numeral = Number . parseInt ( num ) ;
297+ const numeral = Number . parseInt ( num , 10 ) ;
298298 if ( Number . isNaN ( numeral ) ) {
299299 throw `"${ num } " is not a number` ;
300300 } else {
0 commit comments