X-Git-Url: https://git.kianting.info/?a=blobdiff_plain;f=src%2Ftokenize.ts;h=144dbedc0736f5eae1da0063ad9869e321e59d7c;hb=f801ef14fc25ae122aaef4aede639ddb9b37006a;hp=e597a9ed09c6aeb1831c64bef1e962398b3d9a5e;hpb=6f2e788329da7702ea96dc28ae04499917ec8152;p=clo diff --git a/src/tokenize.ts b/src/tokenize.ts index e597a9e..144dbed 100644 --- a/src/tokenize.ts +++ b/src/tokenize.ts @@ -1,3 +1,4 @@ +import * as util from 'util'; var fs = require('fs'); @@ -63,7 +64,7 @@ export interface MatcheePair { * SEMI_C// semi-colon */ export enum TokenType { - NL, // newlinw + NL, // newline SP, // half-width space and tab ID, // identifier STR, // string @@ -205,7 +206,7 @@ export function matchRange(l: string, u: string): (m: MatcheePair) => Maybe Maybe { +export function matchWord(s: string, ): (m: MatcheePair) => Maybe { return (m)=>{ if (s.length==0){ return { _tag: "None" }; @@ -377,7 +378,7 @@ export function tokenize(input: string): Array { // space = [ \t]+ let space = bTerm((x: Maybe) => thenDo(thenDo(x, s_aux), zeroOrMoreDo(s_aux)), - TokenType.INT); + TokenType.SP); // newline = \r?\n let newline = bTerm((x: Maybe) =>