"unicode/utf8"
)
-var yyprev int
-
-var yylast int
-
var imported_unsafe bool
var (
lexinit()
typeinit()
lexinit1()
- // TODO(rsc): Restore yytinit?
blockgen = 1
dclcontext = PEXTERN
imported_unsafe = false
- yyparse()
+ parse_file()
if nsyntaxerrors != 0 {
errorexit()
}
LVAR
LANDAND
LANDNOT
- LBODY
LCOMM
LDEC
LEQ
}
}
-type yy struct{}
-
-func (yy) Lex(v *yySymType) int {
- return int(yylex(v))
-}
-
-func (yy) Error(msg string) {
- Yyerror("%s", msg)
-}
-
-var parsing bool
-
-func yyparse() {
- parsing = true
- parse_file()
- parsing = false
-}
-
func yylex(yylval *yySymType) int32 {
- lx := int(_yylex(yylval))
+ lx := _yylex(yylval)
if curio.nlsemi && lx == EOF {
// Treat EOF as "end of line" for the purposes
curio.nlsemi = false
}
- // Track last two tokens returned by yylex.
- yyprev = yylast
-
- yylast = lx
- return int32(lx)
+ return lx
}
func getc() int {
return fmt.Sprintf("LEX-%d", lex)
}
-var yytfix = map[string]string{
- "$end": "EOF",
- "LASOP": "op=",
- "LBREAK": "break",
- "LCASE": "case",
- "LCHAN": "chan",
- "LCOLAS": ":=",
- "LCONST": "const",
- "LCONTINUE": "continue",
- "LDDD": "...",
- "LDEFAULT": "default",
- "LDEFER": "defer",
- "LELSE": "else",
- "LFALL": "fallthrough",
- "LFOR": "for",
- "LFUNC": "func",
- "LGO": "go",
- "LGOTO": "goto",
- "LIF": "if",
- "LIMPORT": "import",
- "LINTERFACE": "interface",
- "LMAP": "map",
- "LNAME": "name",
- "LPACKAGE": "package",
- "LRANGE": "range",
- "LRETURN": "return",
- "LSELECT": "select",
- "LSTRUCT": "struct",
- "LSWITCH": "switch",
- "LTYPE": "type",
- "LVAR": "var",
- "LANDAND": "&&",
- "LANDNOT": "&^",
- "LBODY": "{",
- "LCOMM": "<-",
- "LDEC": "--",
- "LINC": "++",
- "LEQ": "==",
- "LGE": ">=",
- "LGT": ">",
- "LLE": "<=",
- "LLT": "<",
- "LLSH": "<<",
- "LRSH": ">>",
- "LOROR": "||",
- "LNE": "!=",
- // spell out to avoid confusion with punctuation in error messages
- "';'": "semicolon or newline",
- "','": "comma",
-}
-
func pkgnotused(lineno int, path string, name string) {
// If the package was imported with a name other than the final
// import path element, show it explicitly in the error message.