ref: da5bfc6d15a50130afdcd37ed9af737a81724506
dir: /mparse/tokdefs.myr/
use std use "types.use" pkg parse = type tok = union `Terror `Teof `Tplus /* + */ `Tminus /* - */ `Tmul /* * */ `Tdiv /* / */ `Tinc /* ++ */ `Tdec /* -- */ `Tmod /* % */ `Tasn /* = */ `Taddeq /* += */ `Tsubeq /* -= */ `Tmuleq /* *= */ `Tdiveq /* /= */ `Tmodeq /* %= */ `Tboreq /* |= */ `Tbxoreq /* ^= */ `Tbandeq /* &= */ `Tbsleq /* <<= */ `Tbsreq /* >>= */ `Tbor /* | */ `Tbxor /* ^ */ `Tband /* & */ `Tbsl /* << */ `Tbsr /* >> */ `Tbnot /* ~ */ `Teq /* == */ `Tgt /* > */ `Tlt /* < */ `Tge /* >= */ `Tle /* <= */ `Tne /* != */ `Tlor /* || */ `Tland /* && */ `Tlnot /* ! */ `Tobrace /* { */ `Tcbrace /* } */ `Toparen /* ( */ `Tcparen /* ) */ `Tosqbrac /* [ */ `Tcsqbrac /* ] */ `Tat /* @ */ `Ttick /* ` */ `Tderef /* # */ `Tidxlen /* $ */ `Ttype /* type */ `Tfor /* for */ `Tin /* in */ `Twhile /* while */ `Tif /* if */ `Telse /* else */ `Telif /* else */ `Tmatch /* match */ `Tgoto /* goto */ `Tbreak /* break */ `Tcontinue /* continue */ `Tintlit (int64, int, bool) /* val, sz, sign */ `Tstrlit byte[:] `Tfltlit flt64 `Tchrlit char `Tboollit bool `Tvoidlit `Ttrait /* trait */ `Timpl /* trait */ `Tstruct /* struct */ `Tunion /* union */ `Ttyparam byte[:] /* @typename */ `Tconst /* const */ `Tvar /* var */ `Tgeneric /* var */ `Tcast /* castto */ `Tgap /* _ */ `Tellipsis/* ... */ `Tendln /* ; or \n */ `Tendblk /* ;; */ `Tcolon /* : */ `Twith /* :: */ `Tdot /* . */ `Tcomma /* , */ `Tret /* -> */ `Tuse /* use */ `Tpkg /* pkg */ `Tsizeof /* sizeof */ `Tattr attr /* $attr */ `Tident byte[:] ;; ;; const __init__ = { var dummy : tok dummy = `Terror std.fmtinstall(std.typeof(dummy), tokfmt, [][:]) } const tokfmt = {sb, ap, opts var tok tok = std.vanext(ap) match tok | `Terror: std.sbfmt(sb, "ERROR") | `Teof: std.sbfmt(sb, "EOF") | `Tplus: std.sbfmt(sb, "+") | `Tminus: std.sbfmt(sb, "-") | `Tmul: std.sbfmt(sb, "*") | `Tdiv: std.sbfmt(sb, "/") | `Tinc: std.sbfmt(sb, "++") | `Tdec: std.sbfmt(sb, "--") | `Tmod: std.sbfmt(sb, "%") | `Tasn: std.sbfmt(sb, "=") | `Taddeq: std.sbfmt(sb, "+=") | `Tsubeq: std.sbfmt(sb, "-=") | `Tmuleq: std.sbfmt(sb, "*=") | `Tdiveq: std.sbfmt(sb, "/=") | `Tmodeq: std.sbfmt(sb, "%=") | `Tboreq: std.sbfmt(sb, "|=") | `Tbxoreq: std.sbfmt(sb, "^=") | `Tbandeq: std.sbfmt(sb, "&=") | `Tbsleq: std.sbfmt(sb, "<<=") | `Tbsreq: std.sbfmt(sb, ">>=") | `Tbor: std.sbfmt(sb, "|") | `Tbxor: std.sbfmt(sb, "^") | `Tband: std.sbfmt(sb, "&") | `Tbsl: std.sbfmt(sb, "<<") | `Tbsr: std.sbfmt(sb, ">>") | `Tbnot: std.sbfmt(sb, "~") | `Teq: std.sbfmt(sb, "==") | `Tgt: std.sbfmt(sb, ">") | `Tlt: std.sbfmt(sb, "<") | `Tge: std.sbfmt(sb, ">=") | `Tle: std.sbfmt(sb, "<=") | `Tne: std.sbfmt(sb, "!=") | `Tlor: std.sbfmt(sb, "||") | `Tland: std.sbfmt(sb, "&&") | `Tlnot: std.sbfmt(sb, "!") | `Tobrace: std.sbfmt(sb, "{{") | `Tcbrace: std.sbfmt(sb, "}}") | `Toparen: std.sbfmt(sb, "(") | `Tcparen: std.sbfmt(sb, ")") | `Tosqbrac: std.sbfmt(sb, "[") | `Tcsqbrac: std.sbfmt(sb, "]") | `Tat: std.sbfmt(sb, "@") | `Ttick: std.sbfmt(sb, "`") | `Tderef: std.sbfmt(sb, "#") | `Tidxlen: std.sbfmt(sb, "$") | `Ttype: std.sbfmt(sb, "type") | `Tfor: std.sbfmt(sb, "for") | `Tin: std.sbfmt(sb, "in") | `Twhile: std.sbfmt(sb, "while") | `Tif: std.sbfmt(sb, "if") | `Telse: std.sbfmt(sb, "else") | `Telif: std.sbfmt(sb, "else") | `Tmatch: std.sbfmt(sb, "match") | `Tgoto: std.sbfmt(sb, "goto") | `Tbreak: std.sbfmt(sb, "break") | `Tcontinue: std.sbfmt(sb, "continue") | `Tintlit v: std.sbfmt(sb, "{}", v) | `Tstrlit v: std.sbfmt(sb, "{e}", v) | `Tfltlit v: std.sbfmt(sb, "{}", v) | `Tchrlit v: std.sbfmt(sb, "{}", v) | `Tboollit v: std.sbfmt(sb, "{}", v) | `Tvoidlit: std.sbfmt(sb, "void") | `Ttrait: std.sbfmt(sb, "trait") | `Timpl: std.sbfmt(sb, "trait") | `Tstruct: std.sbfmt(sb, "struct") | `Tunion: std.sbfmt(sb, "union") | `Ttyparam tp: std.sbfmt(sb, "@{}", tp) | `Tconst: std.sbfmt(sb, "const") | `Tvar: std.sbfmt(sb, "var") | `Tgeneric: std.sbfmt(sb, "var") | `Tcast: std.sbfmt(sb, "castto") | `Tgap: std.sbfmt(sb, "_") | `Tellipsis: std.sbfmt(sb, "...") | `Tendln: std.sbfmt(sb, ";") | `Tendblk: std.sbfmt(sb, ";;") | `Tcolon: std.sbfmt(sb, ":") | `Twith: std.sbfmt(sb, "::") | `Tdot: std.sbfmt(sb, ".") | `Tcomma: std.sbfmt(sb, ",") | `Tret: std.sbfmt(sb, "->") | `Tuse: std.sbfmt(sb, "use") | `Tpkg: std.sbfmt(sb, "pkg") | `Tattr a: std.sbfmt(sb, "{}", a) | `Tsizeof: std.sbfmt(sb, "sizeof") | `Tident str: std.sbfmt(sb, "{}", str) ;; }