function e(e){var t=[];return e.split(` `).forEach(function(e){t.push({name:e})}),t}var t=e(`INVERT AND OR XOR 2* 2/ LSHIFT RSHIFT 0= = 0< < > U< MIN MAX 2DROP 2DUP 2OVER 2SWAP ?DUP DEPTH DROP DUP OVER ROT SWAP >R R> R@ + - 1+ 1- ABS NEGATE S>D * M* UM* FM/MOD SM/REM UM/MOD */ */MOD / /MOD MOD HERE , @ ! CELL+ CELLS C, C@ C! CHARS 2@ 2! ALIGN ALIGNED +! ALLOT CHAR [CHAR] [ ] BL FIND EXECUTE IMMEDIATE COUNT LITERAL STATE ; DOES> >BODY EVALUATE SOURCE >IN <# # #S #> HOLD SIGN BASE >NUMBER HEX DECIMAL FILL MOVE . CR EMIT SPACE SPACES TYPE U. .R U.R ACCEPT TRUE FALSE <> U> 0<> 0> NIP TUCK ROLL PICK 2>R 2R@ 2R> WITHIN UNUSED MARKER I J TO COMPILE, [COMPILE] SAVE-INPUT RESTORE-INPUT PAD ERASE 2LITERAL DNEGATE D- D+ D0< D0= D2* D2/ D< D= DMAX DMIN D>S DABS M+ M*/ D. D.R 2ROT DU< CATCH THROW FREE RESIZE ALLOCATE CS-PICK CS-ROLL GET-CURRENT SET-CURRENT FORTH-WORDLIST GET-ORDER SET-ORDER PREVIOUS SEARCH-WORDLIST WORDLIST FIND ALSO ONLY FORTH DEFINITIONS ORDER -TRAILING /STRING SEARCH COMPARE CMOVE CMOVE> BLANK SLITERAL`),n=e(`IF ELSE THEN BEGIN WHILE REPEAT UNTIL RECURSE [IF] [ELSE] [THEN] ?DO DO LOOP +LOOP UNLOOP LEAVE EXIT AGAIN CASE OF ENDOF ENDCASE`);function r(e,t){var n;for(n=e.length-1;n>=0;n--)if(e[n].name===t.toUpperCase())return e[n]}const i={name:`forth`,startState:function(){return{state:``,base:10,coreWordList:t,immediateWordList:n,wordList:[]}},token:function(e,t){var n;if(e.eatSpace())return null;if(t.state===``){if(e.match(/^(\]|:NONAME)(\s|$)/i))return t.state=` compilation`,`builtin`;if(n=e.match(/^(\:)\s+(\S+)(\s|$)+/),n)return t.wordList.push({name:n[2].toUpperCase()}),t.state=` compilation`,`def`;if(n=e.match(/^(VARIABLE|2VARIABLE|CONSTANT|2CONSTANT|CREATE|POSTPONE|VALUE|WORD)\s+(\S+)(\s|$)+/i),n)return t.wordList.push({name:n[2].toUpperCase()}),`def`;if(n=e.match(/^(\'|\[\'\])\s+(\S+)(\s|$)+/),n)return`builtin`}else{if(e.match(/^(\;|\[)(\s)/))return t.state=``,e.backUp(1),`builtin`;if(e.match(/^(\;|\[)($)/))return t.state=``,`builtin`;if(e.match(/^(POSTPONE)\s+\S+(\s|$)+/))return`builtin`}if(n=e.match(/^(\S+)(\s+|$)/),n)return r(t.wordList,n[1])===void 0?n[1]===`\\`?(e.skipToEnd(),`comment`):r(t.coreWordList,n[1])===void 0?r(t.immediateWordList,n[1])===void 0?n[1]===`(`?(e.eatWhile(function(e){return e!==`)`}),e.eat(`)`),`comment`):n[1]===`.(`?(e.eatWhile(function(e){return e!==`)`}),e.eat(`)`),`string`):n[1]===`S"`||n[1]===`."`||n[1]===`C"`?(e.eatWhile(function(e){return e!==`"`}),e.eat(`"`),`string`):n[1]-68719476735?`number`:`atom`:`keyword`:`builtin`:`variable`}};export{i as forth};