示例#1
0
文件: rules.go 项目: se77en/c6
func (parser *Parser) ParseIdent() *ast.Ident {
	var tok = parser.next()
	if tok.Type != ast.T_IDENT {
		panic("Invalid token for ident.")
	}
	return ast.NewIdentWithToken(tok)
}
示例#2
0
文件: rules.go 项目: se77en/c6
func (parser *Parser) ParsePropertyNameToken() ast.Expr {
	if tok := parser.accept(ast.T_PROPERTY_NAME_TOKEN); tok != nil {
		return ast.NewIdentWithToken(tok)
	}

	var tok = parser.peek()
	if tok.Type == ast.T_INTERPOLATION_START {
		return parser.ParseInterpolation()
	}
	return nil
}