@@ -31,15 +31,6 @@ const hashSign = matchString("#", "hash sign");
31
31
const backtick = matchString ( "`" , "backtick" ) ;
32
32
const colon = matchString ( ":" , "colon" ) ;
33
33
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
-
43
34
const character = match ( / ./ u, "character" ) ;
44
35
const wordCharacter = match (
45
36
new RegExp ( `[^${ escapeRegex ( RESERVED_SYMBOLS ) } ]` ) ,
@@ -62,6 +53,15 @@ const ignore = allWithCheck(
62
53
function lex < T > ( parser : Parser < T > ) : Parser < T > {
63
54
return parser . skip ( ignore ) ;
64
55
}
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
+
65
65
const keyword = memoize ( < T extends string > ( keyword : T ) =>
66
66
lex ( withPosition ( match ( / [ a - z \- ] + / , `"${ keyword } "` ) ) )
67
67
. map ( ( positioned ) =>
@@ -294,7 +294,7 @@ const prepositionDefinition = checkedSimpleUnitWithTemplate(
294
294
. map ( ( preposition ) => ( { type : "preposition" , preposition } ) as const ) ;
295
295
const numeralDefinition = checkedSimpleUnit ( "num" )
296
296
. mapWithPositionedError ( ( num ) => {
297
- const numeral = Number . parseInt ( num ) ;
297
+ const numeral = Number . parseInt ( num , 10 ) ;
298
298
if ( Number . isNaN ( numeral ) ) {
299
299
throw `"${ num } " is not a number` ;
300
300
} else {
0 commit comments