php-parser/php-parser.go

1103 lines
19 KiB
Go
Raw Normal View History

2017-11-07 06:21:38 +00:00
// Code generated by golex. DO NOT EDIT.
// Copyright (c) 2011 CZ.NIC z.s.p.o. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
// blame: jnml, labs.nic.cz
package main
import (
"bufio"
"fmt"
"go/token"
"io"
"os"
"unicode"
"github.com/cznic/golex/lex"
)
// Allocate Character classes anywhere in [0x80, 0xFF].
const (
classUnicodeLeter = iota + 0x80
classUnicodeDigit
classOther
)
var sc int
const (
INITIAL = iota
PHP
STRING
)
type lexer struct {
*lex.Lexer
}
func begin(cond int) {
sc = cond
}
func rune2Class(r rune) int {
if r >= 0 && r < 0x80 { // Keep ASCII as it is.
return int(r)
}
if unicode.IsLetter(r) {
return classUnicodeLeter
}
if unicode.IsDigit(r) {
return classUnicodeDigit
}
return classOther
}
func newLexer(src io.Reader, dst io.Writer, fName string) *lexer {
file := token.NewFileSet().AddFile(fName, -1, 1<<31-1)
lx, err := lex.New(file, bufio.NewReader(src), lex.RuneClass(rune2Class))
if err != nil {
panic(err)
}
return &lexer{lx}
}
type yySymType struct{}
func (l *lexer) unget(r rune) []byte {
l.Unget(l.Lookahead())
chars := l.Token()
lastChar := chars[len(chars)-1]
if lastChar.Rune != r {
return l.TokenBytes(nil)
}
l.Unget(lastChar)
buf := l.TokenBytes(nil)
buf = buf[:len(buf)-1]
return buf
}
2017-11-12 11:13:31 +00:00
func (l *lexer) ungetN(n int) []byte {
l.Unget(l.Lookahead())
chars := l.Token()
for i := 1; i <= n; i++ {
char := chars[len(chars)-i]
l.Unget(char)
}
buf := l.TokenBytes(nil)
buf = buf[:len(buf)-n]
return buf
}
2017-11-07 06:21:38 +00:00
func (l *lexer) Lex() int { // Lex(lval *yySymType)
c := l.Enter()
yystate0:
yyrule := -1
_ = yyrule
c = l.Rule0()
// ([\$]{NCH})*
switch yyt := sc; yyt {
default:
panic(fmt.Errorf(`invalid start condition %d`, yyt))
case 0: // start condition: INITIAL
goto yystart1
case 1: // start condition: PHP
goto yystart11
case 2: // start condition: STRING
2017-11-12 11:13:31 +00:00
goto yystart34
2017-11-07 06:21:38 +00:00
}
goto yystate0 // silence unused label error
goto yyAction // silence unused label error
yyAction:
switch yyrule {
case 1:
goto yyrule1
case 2:
goto yyrule2
case 3:
goto yyrule3
case 4:
goto yyrule4
case 5:
goto yyrule5
case 6:
goto yyrule6
case 7:
goto yyrule7
case 8:
goto yyrule8
case 9:
goto yyrule9
case 10:
goto yyrule10
case 11:
goto yyrule11
case 12:
goto yyrule12
case 13:
goto yyrule13
case 14:
goto yyrule14
case 15:
goto yyrule15
case 16:
goto yyrule16
2017-11-12 11:13:31 +00:00
case 17:
goto yyrule17
case 18:
goto yyrule18
case 19:
goto yyrule19
2017-11-07 06:21:38 +00:00
}
goto yystate1 // silence unused label error
yystate1:
c = l.Next()
yystart1:
switch {
default:
goto yyabort
case c == '<':
goto yystate5
case c == '\n':
goto yystate4
case c == '\t' || c == '\r' || c == ' ':
goto yystate3
case c >= '\x01' && c <= '\b' || c == '\v' || c == '\f' || c >= '\x0e' && c <= '\x1f' || c >= '!' && c <= ';' || c >= '=' && c <= 'ÿ':
goto yystate2
}
yystate2:
c = l.Next()
yyrule = 2
l.Mark()
goto yyrule2
yystate3:
c = l.Next()
yyrule = 1
l.Mark()
switch {
default:
goto yyrule1
case c == '\t' || c == '\n' || c == '\r' || c == ' ':
goto yystate4
}
yystate4:
c = l.Next()
yyrule = 1
l.Mark()
switch {
default:
goto yyrule1
case c == '\t' || c == '\n' || c == '\r' || c == ' ':
goto yystate4
}
yystate5:
c = l.Next()
yyrule = 2
l.Mark()
switch {
default:
goto yyrule2
case c == '?':
goto yystate6
}
yystate6:
c = l.Next()
yyrule = 3
l.Mark()
switch {
default:
goto yyrule3
case c == '=':
goto yystate7
case c == 'p':
goto yystate8
}
yystate7:
c = l.Next()
yyrule = 4
l.Mark()
goto yyrule4
yystate8:
c = l.Next()
switch {
default:
goto yyabort
case c == 'h':
goto yystate9
}
yystate9:
c = l.Next()
switch {
default:
goto yyabort
case c == 'p':
goto yystate10
}
yystate10:
c = l.Next()
yyrule = 3
l.Mark()
goto yyrule3
goto yystate11 // silence unused label error
yystate11:
c = l.Next()
yystart11:
switch {
default:
goto yyabort
case c == '"':
goto yystate15
case c == '$':
2017-11-12 11:13:31 +00:00
goto yystate26
2017-11-07 06:21:38 +00:00
case c == '?':
2017-11-12 11:13:31 +00:00
goto yystate32
2017-11-07 06:21:38 +00:00
case c == '\'':
2017-11-12 11:13:31 +00:00
goto yystate28
2017-11-07 06:21:38 +00:00
case c == '\n':
goto yystate14
case c == '\t' || c == '\r' || c == ' ':
goto yystate13
case c >= '\x01' && c <= '\b' || c == '\v' || c == '\f' || c >= '\x0e' && c <= '\x1f' || c == '!' || c == '#' || c == '%' || c == '&' || c >= '(' && c <= '>' || c >= '@' && c <= 'ÿ':
goto yystate12
}
yystate12:
c = l.Next()
yyrule = 10
l.Mark()
goto yyrule10
yystate13:
c = l.Next()
yyrule = 5
l.Mark()
switch {
default:
goto yyrule5
case c == '\t' || c == '\n' || c == '\r' || c == ' ':
goto yystate14
}
yystate14:
c = l.Next()
yyrule = 5
l.Mark()
switch {
default:
goto yyrule5
case c == '\t' || c == '\n' || c == '\r' || c == ' ':
goto yystate14
}
yystate15:
c = l.Next()
yyrule = 9
l.Mark()
switch {
default:
goto yyrule9
case c == '"':
goto yystate17
case c == '$':
goto yystate18
case c == '\\':
2017-11-12 11:13:31 +00:00
goto yystate22
2017-11-07 06:21:38 +00:00
case c == '{':
2017-11-12 11:13:31 +00:00
goto yystate23
2017-11-07 06:21:38 +00:00
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '[' || c >= ']' && c <= 'z' || c >= '|' && c <= 'ÿ':
goto yystate16
}
yystate16:
c = l.Next()
switch {
default:
goto yyabort
case c == '"':
goto yystate17
case c == '$':
goto yystate18
case c == '\\':
2017-11-12 11:13:31 +00:00
goto yystate22
2017-11-07 06:21:38 +00:00
case c == '{':
2017-11-12 11:13:31 +00:00
goto yystate23
2017-11-07 06:21:38 +00:00
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '[' || c >= ']' && c <= 'z' || c >= '|' && c <= 'ÿ':
goto yystate16
}
yystate17:
c = l.Next()
yyrule = 7
l.Mark()
goto yyrule7
yystate18:
c = l.Next()
switch {
default:
goto yyabort
case c == '"':
goto yystate17
2017-11-12 11:13:31 +00:00
case c == '$':
2017-11-07 06:21:38 +00:00
goto yystate19
2017-11-12 11:13:31 +00:00
case c == '\\':
goto yystate20
2017-11-07 06:21:38 +00:00
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '@' || c == '[' || c == ']' || c == '^' || c == '`' || c >= '|' && c <= '~':
goto yystate16
}
yystate19:
c = l.Next()
switch {
default:
goto yyabort
2017-11-12 11:13:31 +00:00
case c == '$':
goto yystate19
case c == '\\':
goto yystate20
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '@' || c == '[' || c == ']' || c == '^' || c == '`' || c >= '|' && c <= '~':
2017-11-07 06:21:38 +00:00
goto yystate16
}
yystate20:
c = l.Next()
switch {
default:
goto yyabort
case c == '"':
goto yystate21
2017-11-12 11:13:31 +00:00
case c == '$' || c == '{':
goto yystate25
case c == '\\':
goto yystate20
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '[' || c >= ']' && c <= 'z' || c >= '|' && c <= 'ÿ':
2017-11-07 06:21:38 +00:00
goto yystate16
}
yystate21:
c = l.Next()
2017-11-12 11:13:31 +00:00
yyrule = 7
l.Mark()
2017-11-07 06:21:38 +00:00
switch {
default:
2017-11-12 11:13:31 +00:00
goto yyrule7
2017-11-07 06:21:38 +00:00
case c == '"':
2017-11-12 11:13:31 +00:00
goto yystate17
case c == '$':
goto yystate18
2017-11-07 06:21:38 +00:00
case c == '\\':
2017-11-12 11:13:31 +00:00
goto yystate22
2017-11-07 06:21:38 +00:00
case c == '{':
goto yystate23
2017-11-12 11:13:31 +00:00
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '[' || c >= ']' && c <= 'z' || c >= '|' && c <= 'ÿ':
2017-11-07 06:21:38 +00:00
goto yystate16
}
yystate22:
c = l.Next()
switch {
default:
2017-11-12 11:13:31 +00:00
goto yyabort
case c >= '\x01' && c <= '\t' || c >= '\v' && c <= 'ÿ':
goto yystate16
}
yystate23:
c = l.Next()
switch {
default:
goto yyabort
2017-11-07 06:21:38 +00:00
case c == '"':
goto yystate17
case c == '\\':
2017-11-12 11:13:31 +00:00
goto yystate20
2017-11-07 06:21:38 +00:00
case c == '{':
2017-11-12 11:13:31 +00:00
goto yystate24
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '[' || c >= ']' && c <= 'z' || c >= '|' && c <= 'ÿ':
goto yystate16
}
yystate24:
c = l.Next()
switch {
default:
goto yyabort
case c == '\\':
2017-11-07 06:21:38 +00:00
goto yystate20
2017-11-12 11:13:31 +00:00
case c == '{':
goto yystate24
2017-11-07 06:21:38 +00:00
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '[' || c >= ']' && c <= 'z' || c >= '|' && c <= 'ÿ':
goto yystate16
}
2017-11-12 11:13:31 +00:00
yystate25:
2017-11-07 06:21:38 +00:00
c = l.Next()
switch {
default:
goto yyabort
case c == '"':
goto yystate17
case c == '$':
goto yystate18
case c == '\\':
2017-11-12 11:13:31 +00:00
goto yystate20
2017-11-07 06:21:38 +00:00
case c == '{':
goto yystate23
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '[' || c >= ']' && c <= 'z' || c >= '|' && c <= 'ÿ':
goto yystate16
}
2017-11-12 11:13:31 +00:00
yystate26:
2017-11-07 06:21:38 +00:00
c = l.Next()
yyrule = 10
l.Mark()
switch {
default:
goto yyrule10
case c >= 'A' && c <= 'Z' || c == '_' || c >= 'a' && c <= 'z' || c >= '\u007f' && c <= 'ÿ':
2017-11-12 11:13:31 +00:00
goto yystate27
2017-11-07 06:21:38 +00:00
}
2017-11-12 11:13:31 +00:00
yystate27:
2017-11-07 06:21:38 +00:00
c = l.Next()
2017-11-12 11:13:31 +00:00
yyrule = 19
2017-11-07 06:21:38 +00:00
l.Mark()
switch {
default:
2017-11-12 11:13:31 +00:00
goto yyrule19
2017-11-07 06:21:38 +00:00
case c >= '0' && c <= '9' || c >= 'A' && c <= 'Z' || c == '_' || c >= 'a' && c <= 'z' || c >= '\u007f' && c <= 'ÿ':
2017-11-12 11:13:31 +00:00
goto yystate27
2017-11-07 06:21:38 +00:00
}
2017-11-12 11:13:31 +00:00
yystate28:
2017-11-07 06:21:38 +00:00
c = l.Next()
yyrule = 10
l.Mark()
switch {
default:
goto yyrule10
case c == '\'':
2017-11-12 11:13:31 +00:00
goto yystate30
2017-11-07 06:21:38 +00:00
case c == '\\':
2017-11-12 11:13:31 +00:00
goto yystate31
2017-11-07 06:21:38 +00:00
case c >= '\x01' && c <= '&' || c >= '(' && c <= '[' || c >= ']' && c <= 'ÿ':
2017-11-12 11:13:31 +00:00
goto yystate29
2017-11-07 06:21:38 +00:00
}
2017-11-12 11:13:31 +00:00
yystate29:
2017-11-07 06:21:38 +00:00
c = l.Next()
switch {
default:
goto yyabort
case c == '\'':
2017-11-12 11:13:31 +00:00
goto yystate30
2017-11-07 06:21:38 +00:00
case c == '\\':
2017-11-12 11:13:31 +00:00
goto yystate31
2017-11-07 06:21:38 +00:00
case c >= '\x01' && c <= '&' || c >= '(' && c <= '[' || c >= ']' && c <= 'ÿ':
2017-11-12 11:13:31 +00:00
goto yystate29
2017-11-07 06:21:38 +00:00
}
2017-11-12 11:13:31 +00:00
yystate30:
2017-11-07 06:21:38 +00:00
c = l.Next()
yyrule = 8
l.Mark()
goto yyrule8
2017-11-12 11:13:31 +00:00
yystate31:
2017-11-07 06:21:38 +00:00
c = l.Next()
switch {
default:
goto yyabort
case c == '\'':
2017-11-12 11:13:31 +00:00
goto yystate29
2017-11-07 06:21:38 +00:00
}
2017-11-12 11:13:31 +00:00
yystate32:
2017-11-07 06:21:38 +00:00
c = l.Next()
yyrule = 10
l.Mark()
switch {
default:
goto yyrule10
case c == '>':
2017-11-12 11:13:31 +00:00
goto yystate33
2017-11-07 06:21:38 +00:00
}
2017-11-12 11:13:31 +00:00
yystate33:
2017-11-07 06:21:38 +00:00
c = l.Next()
yyrule = 6
l.Mark()
goto yyrule6
2017-11-12 11:13:31 +00:00
goto yystate34 // silence unused label error
yystate34:
2017-11-07 06:21:38 +00:00
c = l.Next()
2017-11-12 11:13:31 +00:00
yystart34:
2017-11-07 06:21:38 +00:00
switch {
default:
goto yyabort
case c == '"':
2017-11-12 11:13:31 +00:00
goto yystate59
2017-11-07 06:21:38 +00:00
case c == '$':
2017-11-12 11:13:31 +00:00
goto yystate60
2017-11-07 06:21:38 +00:00
case c == '\\':
2017-11-12 11:13:31 +00:00
goto yystate46
2017-11-07 06:21:38 +00:00
case c == '{':
2017-11-12 11:13:31 +00:00
goto yystate62
2017-11-07 06:21:38 +00:00
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '[' || c >= ']' && c <= 'z' || c >= '|' && c <= 'ÿ':
2017-11-12 11:13:31 +00:00
goto yystate35
2017-11-07 06:21:38 +00:00
}
2017-11-12 11:13:31 +00:00
yystate35:
2017-11-07 06:21:38 +00:00
c = l.Next()
switch {
default:
2017-11-12 11:13:31 +00:00
goto yyabort
2017-11-07 06:21:38 +00:00
case c == '"':
2017-11-12 11:13:31 +00:00
goto yystate36
2017-11-07 06:21:38 +00:00
case c == '$':
2017-11-12 11:13:31 +00:00
goto yystate39
2017-11-07 06:21:38 +00:00
case c == '\\':
2017-11-12 11:13:31 +00:00
goto yystate46
2017-11-07 06:21:38 +00:00
case c == '{':
2017-11-12 11:13:31 +00:00
goto yystate49
2017-11-07 06:21:38 +00:00
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '[' || c >= ']' && c <= 'z' || c >= '|' && c <= 'ÿ':
2017-11-12 11:13:31 +00:00
goto yystate35
2017-11-07 06:21:38 +00:00
}
2017-11-12 11:13:31 +00:00
yystate36:
2017-11-07 06:21:38 +00:00
c = l.Next()
yyrule = 15
l.Mark()
2017-11-12 11:13:31 +00:00
switch {
default:
goto yyrule15
case c == '$':
goto yystate37
}
2017-11-07 06:21:38 +00:00
2017-11-12 11:13:31 +00:00
yystate37:
c = l.Next()
switch {
default:
goto yyabort
case c == '$':
goto yystate37
case c >= 'A' && c <= 'Z' || c == '_' || c >= 'a' && c <= 'z' || c >= '\u007f' && c <= 'ÿ':
goto yystate38
}
yystate38:
c = l.Next()
yyrule = 18
l.Mark()
goto yyrule18
yystate39:
2017-11-07 06:21:38 +00:00
c = l.Next()
switch {
default:
goto yyabort
case c == '"':
2017-11-12 11:13:31 +00:00
goto yystate42
case c == '$':
goto yystate43
2017-11-07 06:21:38 +00:00
case c == '\\':
2017-11-12 11:13:31 +00:00
goto yystate44
case c == '{':
goto yystate58
case c >= 'A' && c <= 'Z' || c == '_' || c >= 'a' && c <= 'z' || c >= '\u007f' && c <= 'ÿ':
goto yystate38
2017-11-07 06:21:38 +00:00
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '@' || c == '[' || c == ']' || c == '^' || c == '`' || c >= '|' && c <= '~':
2017-11-12 11:13:31 +00:00
goto yystate40
2017-11-07 06:21:38 +00:00
}
2017-11-12 11:13:31 +00:00
yystate40:
2017-11-07 06:21:38 +00:00
c = l.Next()
switch {
default:
goto yyabort
2017-11-12 11:13:31 +00:00
case c == '"':
goto yystate36
case c == '$':
goto yystate41
case c == '\\':
goto yystate46
case c == '{':
goto yystate49
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '[' || c >= ']' && c <= 'z' || c >= '|' && c <= 'ÿ':
goto yystate35
2017-11-07 06:21:38 +00:00
}
2017-11-12 11:13:31 +00:00
yystate41:
2017-11-07 06:21:38 +00:00
c = l.Next()
switch {
default:
goto yyabort
case c == '"':
2017-11-12 11:13:31 +00:00
goto yystate42
case c == '$':
goto yystate43
2017-11-07 06:21:38 +00:00
case c == '\\':
2017-11-12 11:13:31 +00:00
goto yystate44
case c == '{':
goto yystate58
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '@' || c == '[' || c == ']' || c == '^' || c == '`' || c >= '|' && c <= '~':
goto yystate40
2017-11-07 06:21:38 +00:00
}
2017-11-12 11:13:31 +00:00
yystate42:
2017-11-07 06:21:38 +00:00
c = l.Next()
yyrule = 15
l.Mark()
2017-11-12 11:13:31 +00:00
goto yyrule15
yystate43:
c = l.Next()
2017-11-07 06:21:38 +00:00
switch {
default:
2017-11-12 11:13:31 +00:00
goto yyabort
case c == '$':
goto yystate43
2017-11-07 06:21:38 +00:00
case c == '\\':
2017-11-12 11:13:31 +00:00
goto yystate44
case c == '{':
goto yystate58
case c >= 'A' && c <= 'Z' || c == '_' || c >= 'a' && c <= 'z' || c >= '\u007f' && c <= 'ÿ':
2017-11-07 06:21:38 +00:00
goto yystate38
2017-11-12 11:13:31 +00:00
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '@' || c == '[' || c == ']' || c == '^' || c == '`' || c >= '|' && c <= '~':
goto yystate40
}
yystate44:
c = l.Next()
switch {
default:
goto yyabort
case c == '"':
goto yystate45
case c == '$':
goto yystate52
case c == '\\':
goto yystate53
2017-11-07 06:21:38 +00:00
case c == '{':
2017-11-12 11:13:31 +00:00
goto yystate56
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '[' || c >= ']' && c <= 'z' || c >= '|' && c <= 'ÿ':
goto yystate35
2017-11-07 06:21:38 +00:00
}
2017-11-12 11:13:31 +00:00
yystate45:
2017-11-07 06:21:38 +00:00
c = l.Next()
yyrule = 15
l.Mark()
switch {
default:
goto yyrule15
case c == '"':
2017-11-12 11:13:31 +00:00
goto yystate36
2017-11-07 06:21:38 +00:00
case c == '$':
2017-11-12 11:13:31 +00:00
goto yystate39
case c == '\\':
goto yystate46
case c == '{':
goto yystate49
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '[' || c >= ']' && c <= 'z' || c >= '|' && c <= 'ÿ':
2017-11-07 06:21:38 +00:00
goto yystate35
2017-11-12 11:13:31 +00:00
}
yystate46:
c = l.Next()
switch {
default:
goto yyabort
case c == '$':
goto yystate47
case c >= '\x01' && c <= '\t' || c >= '\v' && c <= '#' || c >= '%' && c <= 'ÿ':
goto yystate40
}
yystate47:
c = l.Next()
switch {
default:
goto yyabort
case c == '"':
goto yystate36
case c == '$':
goto yystate39
2017-11-07 06:21:38 +00:00
case c == '\\':
2017-11-12 11:13:31 +00:00
goto yystate46
2017-11-07 06:21:38 +00:00
case c == '{':
2017-11-12 11:13:31 +00:00
goto yystate49
case c >= 'A' && c <= 'Z' || c == '_' || c >= 'a' && c <= 'z' || c >= '\u007f' && c <= 'ÿ':
goto yystate48
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '@' || c == '[' || c == ']' || c == '^' || c == '`' || c >= '|' && c <= '~':
goto yystate35
}
yystate48:
c = l.Next()
yyrule = 18
l.Mark()
switch {
default:
goto yyrule18
case c == '"':
goto yystate36
case c == '$':
2017-11-07 06:21:38 +00:00
goto yystate39
2017-11-12 11:13:31 +00:00
case c == '\\':
goto yystate46
case c == '{':
goto yystate49
2017-11-07 06:21:38 +00:00
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '[' || c >= ']' && c <= 'z' || c >= '|' && c <= 'ÿ':
2017-11-12 11:13:31 +00:00
goto yystate35
2017-11-07 06:21:38 +00:00
}
2017-11-12 11:13:31 +00:00
yystate49:
2017-11-07 06:21:38 +00:00
c = l.Next()
2017-11-12 11:13:31 +00:00
switch {
default:
goto yyabort
case c == '"':
goto yystate42
case c == '$':
goto yystate50
case c == '\\':
goto yystate44
case c == '{':
goto yystate51
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '[' || c >= ']' && c <= 'z' || c >= '|' && c <= 'ÿ':
goto yystate40
}
2017-11-07 06:21:38 +00:00
2017-11-12 11:13:31 +00:00
yystate50:
2017-11-07 06:21:38 +00:00
c = l.Next()
2017-11-12 11:13:31 +00:00
yyrule = 16
2017-11-07 06:21:38 +00:00
l.Mark()
2017-11-12 11:13:31 +00:00
goto yyrule16
yystate51:
c = l.Next()
2017-11-07 06:21:38 +00:00
switch {
default:
2017-11-12 11:13:31 +00:00
goto yyabort
case c == '$':
goto yystate50
2017-11-07 06:21:38 +00:00
case c == '\\':
2017-11-12 11:13:31 +00:00
goto yystate44
case c == '{':
goto yystate51
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '[' || c >= ']' && c <= 'z' || c >= '|' && c <= 'ÿ':
goto yystate40
}
yystate52:
c = l.Next()
switch {
default:
goto yyabort
case c == '"':
2017-11-07 06:21:38 +00:00
goto yystate36
2017-11-12 11:13:31 +00:00
case c == '$':
goto yystate39
case c == '\\':
goto yystate53
2017-11-07 06:21:38 +00:00
case c == '{':
2017-11-12 11:13:31 +00:00
goto yystate55
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '[' || c >= ']' && c <= 'z' || c >= '|' && c <= 'ÿ':
goto yystate35
}
yystate53:
c = l.Next()
switch {
default:
goto yyabort
case c == '"':
goto yystate45
case c == '$':
goto yystate54
case c == '\\':
goto yystate53
case c == '{':
goto yystate56
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '[' || c >= ']' && c <= 'z' || c >= '|' && c <= 'ÿ':
goto yystate35
}
yystate54:
c = l.Next()
switch {
default:
goto yyabort
case c == '"':
goto yystate36
case c == '$':
goto yystate39
case c == '\\':
goto yystate53
case c == '{':
goto yystate55
2017-11-07 06:21:38 +00:00
case c >= 'A' && c <= 'Z' || c == '_' || c >= 'a' && c <= 'z' || c >= '\u007f' && c <= 'ÿ':
2017-11-12 11:13:31 +00:00
goto yystate48
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '@' || c == '[' || c == ']' || c == '^' || c == '`' || c >= '|' && c <= '~':
goto yystate35
}
yystate55:
c = l.Next()
yyrule = 17
l.Mark()
switch {
default:
goto yyrule17
case c == '"':
goto yystate42
case c == '$':
goto yystate50
case c == '\\':
goto yystate44
case c == '{':
goto yystate51
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '[' || c >= ']' && c <= 'z' || c >= '|' && c <= 'ÿ':
goto yystate40
}
yystate56:
c = l.Next()
switch {
default:
goto yyabort
case c == '"':
goto yystate36
case c == '$':
goto yystate57
case c == '\\':
goto yystate53
case c == '{':
goto yystate49
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '[' || c >= ']' && c <= 'z' || c >= '|' && c <= 'ÿ':
goto yystate35
}
yystate57:
c = l.Next()
yyrule = 16
l.Mark()
switch {
default:
goto yyrule16
case c == '"':
2017-11-07 06:21:38 +00:00
goto yystate42
2017-11-12 11:13:31 +00:00
case c == '$':
goto yystate43
case c == '\\':
goto yystate44
case c == '{':
goto yystate58
2017-11-07 06:21:38 +00:00
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '@' || c == '[' || c == ']' || c == '^' || c == '`' || c >= '|' && c <= '~':
2017-11-12 11:13:31 +00:00
goto yystate40
2017-11-07 06:21:38 +00:00
}
2017-11-12 11:13:31 +00:00
yystate58:
c = l.Next()
yyrule = 17
l.Mark()
goto yyrule17
yystate59:
c = l.Next()
yyrule = 11
l.Mark()
switch {
default:
goto yyrule11
case c == '$':
goto yystate37
}
yystate60:
2017-11-07 06:21:38 +00:00
c = l.Next()
yyrule = 14
l.Mark()
switch {
default:
goto yyrule14
2017-11-12 11:13:31 +00:00
case c == '"':
2017-11-07 06:21:38 +00:00
goto yystate42
2017-11-12 11:13:31 +00:00
case c == '$':
goto yystate43
case c == '\\':
goto yystate44
case c == '{':
goto yystate61
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '@' || c == '[' || c == ']' || c == '^' || c == '`' || c >= '|' && c <= '~':
goto yystate40
2017-11-07 06:21:38 +00:00
}
2017-11-12 11:13:31 +00:00
yystate61:
2017-11-07 06:21:38 +00:00
c = l.Next()
yyrule = 13
l.Mark()
goto yyrule13
2017-11-12 11:13:31 +00:00
yystate62:
2017-11-07 06:21:38 +00:00
c = l.Next()
switch {
default:
2017-11-12 11:13:31 +00:00
goto yyabort
case c == '"':
goto yystate42
case c == '$':
goto yystate63
2017-11-07 06:21:38 +00:00
case c == '\\':
2017-11-12 11:13:31 +00:00
goto yystate44
case c == '{':
goto yystate51
case c >= '\x01' && c <= '!' || c == '#' || c >= '%' && c <= '[' || c >= ']' && c <= 'z' || c >= '|' && c <= 'ÿ':
goto yystate40
2017-11-07 06:21:38 +00:00
}
2017-11-12 11:13:31 +00:00
yystate63:
c = l.Next()
yyrule = 12
l.Mark()
goto yyrule12
2017-11-07 06:21:38 +00:00
yyrule1: // [ \t\n\r]+
goto yystate0
yyrule2: // .
goto yystate0
yyrule3: // \<\?|\<\?php
{
fmt.Println("T_OPEN_TAG")
begin(PHP)
goto yystate0
}
yyrule4: // \<\?=
{
fmt.Println("T_OPEN_TAG_WITH_ECHO")
begin(PHP)
goto yystate0
}
yyrule5: // [ \t\n\r]+
{
fmt.Println("T_WHITESPACE")
goto yystate0
}
yyrule6: // \?\>
{
fmt.Println("T_CLOSE_TAG")
begin(INITIAL)
goto yystate0
}
2017-11-12 11:13:31 +00:00
yyrule7: // [\"]{STR}{STR_END}
2017-11-07 06:21:38 +00:00
{
fmt.Printf("T_CONSTANT_ENCAPSED_STRING: %s\n", l.TokenBytes(nil))
goto yystate0
}
yyrule8: // [\']([^\\\']*([\\][\'])*)*[\']
{
fmt.Printf("T_CONSTANT_ENCAPSED_STRING: %s\n", l.TokenBytes(nil))
goto yystate0
}
yyrule9: // [\"]
{
fmt.Println("\"")
begin(STRING)
goto yystate0
}
yyrule10: // .
{
fmt.Printf("other: %q\n", l.TokenBytes(nil))
goto yystate0
}
yyrule11: // \"
{
fmt.Println("\"")
begin(PHP)
goto yystate0
}
2017-11-12 11:13:31 +00:00
yyrule12: // \{\$
2017-11-07 06:21:38 +00:00
{
2017-11-12 11:13:31 +00:00
fmt.Printf("T_CURLY_OPEN: %q\n", l.ungetN(1))
2017-11-07 06:21:38 +00:00
goto yystate0
}
yyrule13: // \$\{
{
fmt.Printf("T_DOLLAR_OPEN_CURLY_BRACES: %q\n", l.TokenBytes(nil))
goto yystate0
}
2017-11-12 11:13:31 +00:00
yyrule14: // \$
2017-11-07 06:21:38 +00:00
{
fmt.Printf("T_VARIABLE: %q\n", l.TokenBytes(nil))
goto yystate0
}
2017-11-12 11:13:31 +00:00
yyrule15: // {STR}{STR_END}
{
fmt.Printf("T_ENCAPSED_AND_WHITESPACE1: %q\n", l.unget('"'))
goto yystate0
}
yyrule16: // {STR}[\{]+[\$]
{
fmt.Printf("T_ENCAPSED_AND_WHITESPACE2: %q\n", l.ungetN(2))
goto yystate0
}
yyrule17: // {STR}[\$]+[\{]
{
fmt.Printf("T_ENCAPSED_AND_WHITESPACE3: %q\n", l.ungetN(2))
goto yystate0
}
yyrule18: // {STR}[^\{][\$]+[a-zA-Z_\x7f-\xff]
2017-11-07 06:21:38 +00:00
{
2017-11-12 11:13:31 +00:00
fmt.Printf("T_ENCAPSED_AND_WHITESPACE4: %q\n", l.ungetN(2))
2017-11-07 06:21:38 +00:00
goto yystate0
}
2017-11-12 11:13:31 +00:00
yyrule19: // \${VAR}
2017-11-07 06:21:38 +00:00
{
fmt.Println("T_VARIABLE")
goto yystate0
}
panic("unreachable")
goto yyabort // silence unused label error
yyabort: // no lexem recognized
if c, ok := l.Abort(); ok {
return int(c)
}
goto yyAction
}
func main() {
l := newLexer(os.Stdin, os.Stdout, "file.name")
l.Lex()
}