{- This isn't a lexer in the sense that it provides a JavaScript token-stream.
- This module provides character-parsers for various JavaScript tokens.
-}moduleBrownPLT.JavaScript.Lexer(lexeme,identifier,reserved,operator,reservedOp,charLiteral,stringLiteral,natural,integer,float,naturalOrFloat,decimal,hexadecimal,octal,symbol,whiteSpace,parens,braces,brackets,squares,semi,comma,colon,dot,identifierStart)whereimportPreludehiding(lex)importText.ParserCombinators.ParsecimportqualifiedText.ParserCombinators.Parsec.TokenasTidentifierStart=(letter<|>oneOf"$_")javascriptDef=T.LanguageDef"/*""*/""//"False-- no nested comments{- Adapted from syntax/regexps.ss in Dave's code. -}identifierStart(alphaNum<|>oneOf"$_")-- identifier rest(oneOf"{}<>()~.,?:|&^=!+-*/%!")-- operator start(oneOf"=<>|&+")-- operator rest["break","case","catch","const","continue","debugger","default","delete","do","else","enum","false","finally","for","function","if","instanceof","in","let","new","null","return","switch","this","throw","true","try","typeof","var","void","while","with"]["|=","^=","&=","<<=",">>=",">>>=","+=","-=","*=","/=","%=","=",";",",","?",":","||","&&","|","^","&","===","==","=","!==","!=","<<","<=","<",">>>",">>",">=",">","++","--","+","-","*","/","%","!","~",".","[","]","{","}","(",")","</","instanceof"]True-- case-sensitivelex=T.makeTokenParserjavascriptDef-- everything but commaSep and semiSepidentifier=T.identifierlexreserved=T.reservedlexoperator=T.operatorlexreservedOp=T.reservedOplexcharLiteral=T.charLiterallexstringLiteral=T.stringLiterallexnatural=T.naturallexinteger=T.integerlexfloat=T.floatlexnaturalOrFloat=T.naturalOrFloatlexdecimal=T.decimallexhexadecimal=T.hexadecimallexoctal=T.octallexsymbol=T.symbollexwhiteSpace=T.whiteSpacelexparens=T.parenslexbraces=T.braceslexsquares=T.squareslexsemi=T.semilexcomma=T.commalexcolon=T.colonlexdot=T.dotlexbrackets=T.bracketslexlexeme=T.lexemelex