How to use yyTokname method of json Package

Best Go-testdeep code snippet using json.yyTokname

rule.yacc.go

Source:rule.yacc.go Github

copy

Full Screen

...35const NUM = 5735536const CMP = 5735637const CONTAIN = 5735738const FUNC = 5735839var yyToknames = []string{40 "COMMA",41 "LPAREN",42 "RPAREN",43 "LAND",44 "LOR",45 "GET",46 "DEFAULT",47 "VAR",48 "STR",49 "NUM",50 "CMP",51 "CONTAIN",52 "FUNC",53}54var yyStatenames = []string{}55const yyEofCode = 156const yyErrCode = 257const yyMaxDepth = 20058//line rule.y:5759/*60 parser handle61*/62type Parser struct {63 grammer *Grammer64}65/*66 analyze input rule script and generate parser handle67*/68func NewParser(in io.Reader) (h *Parser, err error) {69 defer func() {70 if e := recover(); e != nil {71 h, err = nil, errors.New(fmt.Sprint(e))72 }73 }()74 h = new(Parser)75 lex := NewLexer(in)76 yyParse(lex)77 g_mutex.Lock()78 h.grammer = g_grammer79 g_mutex.Unlock()80 if h.grammer == nil {81 return h, errors.New("invalid rule")82 }83 return h, err84}85/*86 get parse result87 symlist is created by calling QueryToSymlist() or JsonToSymlist() API88*/89func (h *Parser) Parse(symlist *SymList) (ret int, err error) {90 defer func() {91 if e := recover(); e != nil {92 ret, err = -1, errors.New(fmt.Sprint(e))93 }94 }()95 ret, err = EvalGrammer(h.grammer, symlist)96 return97}98//line yacctab:199var yyExca = []int{100 -1, 1,101 1, -1,102 -2, 0,103}104const yyNprod = 20105const yyPrivate = 57344106var yyTokenNames []string107var yyStates []string108const yyLast = 61109var yyAct = []int{110 6, 29, 5, 2, 19, 18, 7, 14, 15, 16,111 13, 4, 8, 9, 10, 25, 22, 12, 23, 24,112 27, 17, 31, 37, 35, 7, 32, 31, 34, 33,113 4, 8, 9, 10, 30, 3, 12, 31, 38, 8,114 9, 10, 7, 20, 12, 28, 15, 16, 8, 9,115 10, 26, 21, 12, 8, 9, 10, 36, 1, 12,116 11,117}118var yyPact = []int{119 20, -1000, -1000, 1, 12, -1000, -10, 37, -1000, -1000,120 -1000, -1000, 47, 3, -1000, 37, 37, 2, 46, 43,121 39, 28, 20, -1000, -1000, 20, 43, -1000, -1000, 18,122 -1000, 53, -1000, -1000, 17, -1000, 43, -1000, -1000,123}124var yyPgo = []int{125 0, 3, 35, 2, 0, 60, 1, 58,126}127var yyR1 = []int{128 0, 7, 1, 1, 1, 1, 2, 2, 2, 3,129 3, 3, 4, 4, 4, 4, 6, 6, 5, 5,130}131var yyR2 = []int{132 0, 1, 4, 4, 2, 0, 3, 3, 1, 5,133 3, 3, 1, 1, 1, 1, 1, 3, 4, 3,134}135var yyChk = []int{136 -1000, -7, -1, -2, 10, -3, -4, 5, 11, 12,137 13, -5, 16, 9, -1, 7, 8, 9, 15, 14,138 -2, 5, 13, -3, -3, 13, 5, -4, 6, -6,139 6, -4, -1, -1, -6, 6, 4, 6, -6,140}141var yyDef = []int{142 5, -2, 1, 5, 0, 8, 0, 0, 12, 13,143 14, 15, 0, 0, 4, 0, 0, 0, 0, 0,144 0, 0, 5, 6, 7, 5, 0, 10, 11, 0,145 19, 16, 2, 3, 0, 18, 0, 9, 17,146}147var yyTok1 = []int{148 1,149}150var yyTok2 = []int{151 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,152 12, 13, 14, 15, 16,153}154var yyTok3 = []int{155 0,156}157//line yaccpar:1158/* parser for yacc output */159var yyDebug = 0160type yyLexer interface {161 Lex(lval *yySymType) int162 Error(s string)163}164const yyFlag = -1000165func yyTokname(c int) string {166 // 4 is TOKSTART above167 if c >= 4 && c-4 < len(yyToknames) {168 if yyToknames[c-4] != "" {169 return yyToknames[c-4]170 }171 }172 return __yyfmt__.Sprintf("tok-%v", c)173}174func yyStatname(s int) string {175 if s >= 0 && s < len(yyStatenames) {176 if yyStatenames[s] != "" {177 return yyStatenames[s]178 }179 }180 return __yyfmt__.Sprintf("state-%v", s)181}182func yylex1(lex yyLexer, lval *yySymType) int {183 c := 0184 char := lex.Lex(lval)185 if char <= 0 {186 c = yyTok1[0]187 goto out188 }189 if char < len(yyTok1) {190 c = yyTok1[char]191 goto out192 }193 if char >= yyPrivate {194 if char < yyPrivate+len(yyTok2) {195 c = yyTok2[char-yyPrivate]196 goto out197 }198 }199 for i := 0; i < len(yyTok3); i += 2 {200 c = yyTok3[i+0]201 if c == char {202 c = yyTok3[i+1]203 goto out204 }205 }206out:207 if c == 0 {208 c = yyTok2[1] /* unknown char */209 }210 if yyDebug >= 3 {211 __yyfmt__.Printf("lex %s(%d)\n", yyTokname(c), uint(char))212 }213 return c214}215func yyParse(yylex yyLexer) int {216 var yyn int217 var yylval yySymType218 var yyVAL yySymType219 yyS := make([]yySymType, yyMaxDepth)220 Nerrs := 0 /* number of errors */221 Errflag := 0 /* error recovery flag */222 yystate := 0223 yychar := -1224 yyp := -1225 goto yystack226ret0:227 return 0228ret1:229 return 1230yystack:231 /* put a state and value onto the stack */232 if yyDebug >= 4 {233 __yyfmt__.Printf("char %v in %v\n", yyTokname(yychar), yyStatname(yystate))234 }235 yyp++236 if yyp >= len(yyS) {237 nyys := make([]yySymType, len(yyS)*2)238 copy(nyys, yyS)239 yyS = nyys240 }241 yyS[yyp] = yyVAL242 yyS[yyp].yys = yystate243yynewstate:244 yyn = yyPact[yystate]245 if yyn <= yyFlag {246 goto yydefault /* simple state */247 }248 if yychar < 0 {249 yychar = yylex1(yylex, &yylval)250 }251 yyn += yychar252 if yyn < 0 || yyn >= yyLast {253 goto yydefault254 }255 yyn = yyAct[yyn]256 if yyChk[yyn] == yychar { /* valid shift */257 yychar = -1258 yyVAL = yylval259 yystate = yyn260 if Errflag > 0 {261 Errflag--262 }263 goto yystack264 }265yydefault:266 /* default state action */267 yyn = yyDef[yystate]268 if yyn == -2 {269 if yychar < 0 {270 yychar = yylex1(yylex, &yylval)271 }272 /* look through exception table */273 xi := 0274 for {275 if yyExca[xi+0] == -1 && yyExca[xi+1] == yystate {276 break277 }278 xi += 2279 }280 for xi += 2; ; xi += 2 {281 yyn = yyExca[xi+0]282 if yyn < 0 || yyn == yychar {283 break284 }285 }286 yyn = yyExca[xi+1]287 if yyn < 0 {288 goto ret0289 }290 }291 if yyn == 0 {292 /* error ... attempt to resume parsing */293 switch Errflag {294 case 0: /* brand new error */295 yylex.Error("syntax error")296 Nerrs++297 if yyDebug >= 1 {298 __yyfmt__.Printf("%s", yyStatname(yystate))299 __yyfmt__.Printf(" saw %s\n", yyTokname(yychar))300 }301 fallthrough302 case 1, 2: /* incompletely recovered error ... try again */303 Errflag = 3304 /* find a state where "error" is a legal shift action */305 for yyp >= 0 {306 yyn = yyPact[yyS[yyp].yys] + yyErrCode307 if yyn >= 0 && yyn < yyLast {308 yystate = yyAct[yyn] /* simulate a shift of "error" */309 if yyChk[yystate] == yyErrCode {310 goto yystack311 }312 }313 /* the current p has no shift on "error", pop stack */314 if yyDebug >= 2 {315 __yyfmt__.Printf("error recovery pops state %d\n", yyS[yyp].yys)316 }317 yyp--318 }319 /* there is no state on the stack with an error shift ... abort */320 goto ret1321 case 3: /* no shift yet; clobber input char */322 if yyDebug >= 2 {323 __yyfmt__.Printf("error recovery discards %s\n", yyTokname(yychar))324 }325 if yychar == yyEofCode {326 goto ret1327 }328 yychar = -1329 goto yynewstate /* try again in the same state */330 }331 }332 /* reduction by production yyn */333 if yyDebug >= 2 {334 __yyfmt__.Printf("reduce %v in:\n\t%v\n", yyn, yyStatname(yystate))335 }336 yynt := yyn337 yypt := yyp...

Full Screen

Full Screen

json.go

Source:json.go Github

copy

Full Screen

...16const Y_INT = 5734817const Y_FLOAT = 5734918const Y_BOOL = 5735019const Y_NULL = 5735120var yyToknames = [...]string{21 "$end",22 "error",23 "$unk",24 "Y_ERR",25 "'-'",26 "'['",27 "']'",28 "':'",29 "','",30 "'{'",31 "'}'",32 "Y_STR",33 "Y_INT",34 "Y_FLOAT",35 "Y_BOOL",36 "Y_NULL",37}38var yyStatenames = [...]string{}39const yyEofCode = 140const yyErrCode = 241const yyInitialStackSize = 1642var yyExca = [...]int{43 -1, 1,44 1, -1,45 -2, 0,46}47const yyPrivate = 5734448const yyLast = 3249var yyAct = [...]int{50 10, 20, 5, 7, 26, 27, 4, 8, 14, 17,51 18, 15, 16, 21, 5, 22, 1, 24, 4, 25,52 23, 12, 2, 6, 29, 28, 30, 13, 3, 9,53 19, 11,54}55var yyPact = [...]int{56 8, -1000, -1000, -1000, -5, -4, 4, -1000, 12, 10,57 -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000, -1000,58 -9, -5, -1000, -4, -1000, -4, -1000, -1000, -1000, -1000,59 -1000,60}61var yyPgo = [...]int{62 0, 0, 31, 30, 27, 29, 21, 3, 23, 16,63}64var yyR1 = [...]int{65 0, 9, 9, 1, 1, 1, 7, 8, 8, 8,66 6, 4, 5, 5, 5, 2, 2, 2, 2, 2,67 2, 3, 3,68}69var yyR2 = [...]int{70 0, 1, 1, 1, 1, 1, 3, 0, 1, 3,71 3, 3, 0, 1, 3, 1, 1, 1, 1, 1,72 1, 2, 2,73}74var yyChk = [...]int{75 -1000, -9, -6, -4, 10, 6, -8, -7, 12, -5,76 -1, -2, -6, -4, 12, 15, 16, 13, 14, -3,77 5, 9, 11, 8, 7, 9, 13, 14, -7, -1,78 -1,79}80var yyDef = [...]int{81 0, -2, 1, 2, 7, 12, 0, 8, 0, 0,82 13, 3, 4, 5, 15, 16, 17, 18, 19, 20,83 0, 0, 10, 0, 11, 0, 21, 22, 9, 6,84 14,85}86var yyTok1 = [...]int{87 1, 3, 3, 3, 3, 3, 3, 3, 3, 3,88 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,89 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,90 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,91 3, 3, 3, 3, 9, 5, 3, 3, 3, 3,92 3, 3, 3, 3, 3, 3, 3, 3, 8, 3,93 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,94 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,95 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,96 3, 6, 3, 7, 3, 3, 3, 3, 3, 3,97 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,98 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,99 3, 3, 3, 10, 3, 11,100}101var yyTok2 = [...]int{102 2, 3, 4, 12, 13, 14, 15, 16,103}104var yyTok3 = [...]int{105 0,106}107var yyErrorMessages = [...]struct {108 state int109 token int110 msg string111}{}112/* parser for yacc output */113var (114 yyDebug = 0115 yyErrorVerbose = false116)117type yyLexer interface {118 Lex(lval *yySymType) int119 Error(s string)120}121type yyParser interface {122 Parse(yyLexer) int123 Lookahead() int124}125type yyParserImpl struct {126 lval yySymType127 stack [yyInitialStackSize]yySymType128 char int129}130func (p *yyParserImpl) Lookahead() int {131 return p.char132}133func yyNewParser() yyParser {134 return &yyParserImpl{}135}136const yyFlag = -1000137func yyTokname(c int) string {138 if c >= 1 && c-1 < len(yyToknames) {139 if yyToknames[c-1] != "" {140 return yyToknames[c-1]141 }142 }143 return __yyfmt__.Sprintf("tok-%v", c)144}145func yyStatname(s int) string {146 if s >= 0 && s < len(yyStatenames) {147 if yyStatenames[s] != "" {148 return yyStatenames[s]149 }150 }151 return __yyfmt__.Sprintf("state-%v", s)152}153func yyErrorMessage(state, lookAhead int) string {154 const TOKSTART = 4155 if !yyErrorVerbose {156 return "syntax error"157 }158 for _, e := range yyErrorMessages {159 if e.state == state && e.token == lookAhead {160 return "syntax error: " + e.msg161 }162 }163 res := "syntax error: unexpected " + yyTokname(lookAhead)164 // To match Bison, suggest at most four expected tokens.165 expected := make([]int, 0, 4)166 // Look for shiftable tokens.167 base := yyPact[state]168 for tok := TOKSTART; tok-1 < len(yyToknames); tok++ {169 if n := base + tok; n >= 0 && n < yyLast && yyChk[yyAct[n]] == tok {170 if len(expected) == cap(expected) {171 return res172 }173 expected = append(expected, tok)174 }175 }176 if yyDef[state] == -2 {177 i := 0178 for yyExca[i] != -1 || yyExca[i+1] != state {179 i += 2180 }181 // Look for tokens that we accept or reduce.182 for i += 2; yyExca[i] >= 0; i += 2 {183 tok := yyExca[i]184 if tok < TOKSTART || yyExca[i+1] == 0 {185 continue186 }187 if len(expected) == cap(expected) {188 return res189 }190 expected = append(expected, tok)191 }192 // If the default action is to accept or reduce, give up.193 if yyExca[i+1] != 0 {194 return res195 }196 }197 for i, tok := range expected {198 if i == 0 {199 res += ", expecting "200 } else {201 res += " or "202 }203 res += yyTokname(tok)204 }205 return res206}207func yylex1(lex yyLexer, lval *yySymType) (char, token int) {208 token = 0209 char = lex.Lex(lval)210 if char <= 0 {211 token = yyTok1[0]212 goto out213 }214 if char < len(yyTok1) {215 token = yyTok1[char]216 goto out217 }218 if char >= yyPrivate {219 if char < yyPrivate+len(yyTok2) {220 token = yyTok2[char-yyPrivate]221 goto out222 }223 }224 for i := 0; i < len(yyTok3); i += 2 {225 token = yyTok3[i+0]226 if token == char {227 token = yyTok3[i+1]228 goto out229 }230 }231out:232 if token == 0 {233 token = yyTok2[1] /* unknown char */234 }235 if yyDebug >= 3 {236 __yyfmt__.Printf("lex %s(%d)\n", yyTokname(token), uint(char))237 }238 return char, token239}240func yyParse(yylex yyLexer) int {241 return yyNewParser().Parse(yylex)242}243func (yyrcvr *yyParserImpl) Parse(yylex yyLexer) int {244 var yyn int245 var yyVAL yySymType246 var yyDollar []yySymType247 _ = yyDollar // silence set and not used248 yyS := yyrcvr.stack[:]249 Nerrs := 0 /* number of errors */250 Errflag := 0 /* error recovery flag */251 yystate := 0252 yyrcvr.char = -1253 yytoken := -1 // yyrcvr.char translated into internal numbering254 defer func() {255 // Make sure we report no lookahead when not parsing.256 yystate = -1257 yyrcvr.char = -1258 yytoken = -1259 }()260 yyp := -1261 goto yystack262ret0:263 return 0264ret1:265 return 1266yystack:267 /* put a state and value onto the stack */268 if yyDebug >= 4 {269 __yyfmt__.Printf("char %v in %v\n", yyTokname(yytoken), yyStatname(yystate))270 }271 yyp++272 if yyp >= len(yyS) {273 nyys := make([]yySymType, len(yyS)*2)274 copy(nyys, yyS)275 yyS = nyys276 }277 yyS[yyp] = yyVAL278 yyS[yyp].yys = yystate279yynewstate:280 yyn = yyPact[yystate]281 if yyn <= yyFlag {282 goto yydefault /* simple state */283 }284 if yyrcvr.char < 0 {285 yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval)286 }287 yyn += yytoken288 if yyn < 0 || yyn >= yyLast {289 goto yydefault290 }291 yyn = yyAct[yyn]292 if yyChk[yyn] == yytoken { /* valid shift */293 yyrcvr.char = -1294 yytoken = -1295 yyVAL = yyrcvr.lval296 yystate = yyn297 if Errflag > 0 {298 Errflag--299 }300 goto yystack301 }302yydefault:303 /* default state action */304 yyn = yyDef[yystate]305 if yyn == -2 {306 if yyrcvr.char < 0 {307 yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval)308 }309 /* look through exception table */310 xi := 0311 for {312 if yyExca[xi+0] == -1 && yyExca[xi+1] == yystate {313 break314 }315 xi += 2316 }317 for xi += 2; ; xi += 2 {318 yyn = yyExca[xi+0]319 if yyn < 0 || yyn == yytoken {320 break321 }322 }323 yyn = yyExca[xi+1]324 if yyn < 0 {325 goto ret0326 }327 }328 if yyn == 0 {329 /* error ... attempt to resume parsing */330 switch Errflag {331 case 0: /* brand new error */332 yylex.Error(yyErrorMessage(yystate, yytoken))333 Nerrs++334 if yyDebug >= 1 {335 __yyfmt__.Printf("%s", yyStatname(yystate))336 __yyfmt__.Printf(" saw %s\n", yyTokname(yytoken))337 }338 fallthrough339 case 1, 2: /* incompletely recovered error ... try again */340 Errflag = 3341 /* find a state where "error" is a legal shift action */342 for yyp >= 0 {343 yyn = yyPact[yyS[yyp].yys] + yyErrCode344 if yyn >= 0 && yyn < yyLast {345 yystate = yyAct[yyn] /* simulate a shift of "error" */346 if yyChk[yystate] == yyErrCode {347 goto yystack348 }349 }350 /* the current p has no shift on "error", pop stack */351 if yyDebug >= 2 {352 __yyfmt__.Printf("error recovery pops state %d\n", yyS[yyp].yys)353 }354 yyp--355 }356 /* there is no state on the stack with an error shift ... abort */357 goto ret1358 case 3: /* no shift yet; clobber input char */359 if yyDebug >= 2 {360 __yyfmt__.Printf("error recovery discards %s\n", yyTokname(yytoken))361 }362 if yytoken == yyEofCode {363 goto ret1364 }365 yyrcvr.char = -1366 yytoken = -1367 goto yynewstate /* try again in the same state */368 }369 }370 /* reduction by production yyn */371 if yyDebug >= 2 {372 __yyfmt__.Printf("reduce %v in:\n\t%v\n", yyn, yyStatname(yystate))373 }374 yynt := yyn...

Full Screen

Full Screen

parse.go

Source:parse.go Github

copy

Full Screen

...43const TOKLBRACE = 5734744const TOKRBRACE = 5734845const TOKREQUIRE = 5734946const TOKWORD = 5735047var yyToknames = [...]string{48 "$end",49 "error",50 "$unk",51 "TOKCOMMENT",52 "TOKLBRACE",53 "TOKRBRACE",54 "TOKREQUIRE",55 "TOKWORD",56}57var yyStatenames = [...]string{}58const yyEofCode = 159const yyErrCode = 260const yyInitialStackSize = 1661//line gen/parse.yy:12162//line yacctab:163var yyExca = [...]int{64 -1, 1,65 1, -1,66 -2, 0,67}68const yyNprod = 1169const yyPrivate = 5734470var yyTokenNames []string71var yyStates []string72const yyLast = 1873var yyAct = [...]int{74 12, 10, 9, 10, 9, 16, 15, 14, 4, 6,75 11, 8, 7, 5, 3, 13, 2, 1,76}77var yyPact = [...]int{78 -1000, 0, -1000, -4, 5, -6, -1000, -1000, -1000, -1,79 -2, -1000, -1000, -1000, -3, -1000, -1000,80}81var yyPgo = [...]int{82 0, 17, 16, 14, 13, 9, 12, 11,83}84var yyR1 = [...]int{85 0, 1, 1, 2, 3, 4, 4, 5, 5, 6,86 7,87}88var yyR2 = [...]int{89 0, 0, 2, 3, 2, 2, 1, 1, 1, 3,90 2,91}92var yyChk = [...]int{93 -1000, -1, -2, -3, 8, -4, -5, -6, -7, 8,94 7, 5, 6, -5, 8, 8, 8,95}96var yyDef = [...]int{97 1, -2, 2, 0, 0, 0, 6, 7, 8, 0,98 0, 4, 3, 5, 0, 10, 9,99}100var yyTok1 = [...]int{101 1,102}103var yyTok2 = [...]int{104 2, 3, 4, 5, 6, 7, 8,105}106var yyTok3 = [...]int{107 0,108}109var yyErrorMessages = [...]struct {110 state int111 token int112 msg string113}{}114//line yaccpar:1115/* parser for yacc output */116var (117 yyDebug = 0118 yyErrorVerbose = false119)120type yyLexer interface {121 Lex(lval *yySymType) int122 Error(s string)123}124type yyParser interface {125 Parse(yyLexer) int126 Lookahead() int127}128type yyParserImpl struct {129 lval yySymType130 stack [yyInitialStackSize]yySymType131 char int132}133func (p *yyParserImpl) Lookahead() int {134 return p.char135}136func yyNewParser() yyParser {137 return &yyParserImpl{}138}139const yyFlag = -1000140func yyTokname(c int) string {141 if c >= 1 && c-1 < len(yyToknames) {142 if yyToknames[c-1] != "" {143 return yyToknames[c-1]144 }145 }146 return __yyfmt__.Sprintf("tok-%v", c)147}148func yyStatname(s int) string {149 if s >= 0 && s < len(yyStatenames) {150 if yyStatenames[s] != "" {151 return yyStatenames[s]152 }153 }154 return __yyfmt__.Sprintf("state-%v", s)155}156func yyErrorMessage(state, lookAhead int) string {157 const TOKSTART = 4158 if !yyErrorVerbose {159 return "syntax error"160 }161 for _, e := range yyErrorMessages {162 if e.state == state && e.token == lookAhead {163 return "syntax error: " + e.msg164 }165 }166 res := "syntax error: unexpected " + yyTokname(lookAhead)167 // To match Bison, suggest at most four expected tokens.168 expected := make([]int, 0, 4)169 // Look for shiftable tokens.170 base := yyPact[state]171 for tok := TOKSTART; tok-1 < len(yyToknames); tok++ {172 if n := base + tok; n >= 0 && n < yyLast && yyChk[yyAct[n]] == tok {173 if len(expected) == cap(expected) {174 return res175 }176 expected = append(expected, tok)177 }178 }179 if yyDef[state] == -2 {180 i := 0181 for yyExca[i] != -1 || yyExca[i+1] != state {182 i += 2183 }184 // Look for tokens that we accept or reduce.185 for i += 2; yyExca[i] >= 0; i += 2 {186 tok := yyExca[i]187 if tok < TOKSTART || yyExca[i+1] == 0 {188 continue189 }190 if len(expected) == cap(expected) {191 return res192 }193 expected = append(expected, tok)194 }195 // If the default action is to accept or reduce, give up.196 if yyExca[i+1] != 0 {197 return res198 }199 }200 for i, tok := range expected {201 if i == 0 {202 res += ", expecting "203 } else {204 res += " or "205 }206 res += yyTokname(tok)207 }208 return res209}210func yylex1(lex yyLexer, lval *yySymType) (char, token int) {211 token = 0212 char = lex.Lex(lval)213 if char <= 0 {214 token = yyTok1[0]215 goto out216 }217 if char < len(yyTok1) {218 token = yyTok1[char]219 goto out220 }221 if char >= yyPrivate {222 if char < yyPrivate+len(yyTok2) {223 token = yyTok2[char-yyPrivate]224 goto out225 }226 }227 for i := 0; i < len(yyTok3); i += 2 {228 token = yyTok3[i+0]229 if token == char {230 token = yyTok3[i+1]231 goto out232 }233 }234out:235 if token == 0 {236 token = yyTok2[1] /* unknown char */237 }238 if yyDebug >= 3 {239 __yyfmt__.Printf("lex %s(%d)\n", yyTokname(token), uint(char))240 }241 return char, token242}243func yyParse(yylex yyLexer) int {244 return yyNewParser().Parse(yylex)245}246func (yyrcvr *yyParserImpl) Parse(yylex yyLexer) int {247 var yyn int248 var yyVAL yySymType249 var yyDollar []yySymType250 _ = yyDollar // silence set and not used251 yyS := yyrcvr.stack[:]252 Nerrs := 0 /* number of errors */253 Errflag := 0 /* error recovery flag */254 yystate := 0255 yyrcvr.char = -1256 yytoken := -1 // yyrcvr.char translated into internal numbering257 defer func() {258 // Make sure we report no lookahead when not parsing.259 yystate = -1260 yyrcvr.char = -1261 yytoken = -1262 }()263 yyp := -1264 goto yystack265ret0:266 return 0267ret1:268 return 1269yystack:270 /* put a state and value onto the stack */271 if yyDebug >= 4 {272 __yyfmt__.Printf("char %v in %v\n", yyTokname(yytoken), yyStatname(yystate))273 }274 yyp++275 if yyp >= len(yyS) {276 nyys := make([]yySymType, len(yyS)*2)277 copy(nyys, yyS)278 yyS = nyys279 }280 yyS[yyp] = yyVAL281 yyS[yyp].yys = yystate282yynewstate:283 yyn = yyPact[yystate]284 if yyn <= yyFlag {285 goto yydefault /* simple state */286 }287 if yyrcvr.char < 0 {288 yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval)289 }290 yyn += yytoken291 if yyn < 0 || yyn >= yyLast {292 goto yydefault293 }294 yyn = yyAct[yyn]295 if yyChk[yyn] == yytoken { /* valid shift */296 yyrcvr.char = -1297 yytoken = -1298 yyVAL = yyrcvr.lval299 yystate = yyn300 if Errflag > 0 {301 Errflag--302 }303 goto yystack304 }305yydefault:306 /* default state action */307 yyn = yyDef[yystate]308 if yyn == -2 {309 if yyrcvr.char < 0 {310 yyrcvr.char, yytoken = yylex1(yylex, &yyrcvr.lval)311 }312 /* look through exception table */313 xi := 0314 for {315 if yyExca[xi+0] == -1 && yyExca[xi+1] == yystate {316 break317 }318 xi += 2319 }320 for xi += 2; ; xi += 2 {321 yyn = yyExca[xi+0]322 if yyn < 0 || yyn == yytoken {323 break324 }325 }326 yyn = yyExca[xi+1]327 if yyn < 0 {328 goto ret0329 }330 }331 if yyn == 0 {332 /* error ... attempt to resume parsing */333 switch Errflag {334 case 0: /* brand new error */335 yylex.Error(yyErrorMessage(yystate, yytoken))336 Nerrs++337 if yyDebug >= 1 {338 __yyfmt__.Printf("%s", yyStatname(yystate))339 __yyfmt__.Printf(" saw %s\n", yyTokname(yytoken))340 }341 fallthrough342 case 1, 2: /* incompletely recovered error ... try again */343 Errflag = 3344 /* find a state where "error" is a legal shift action */345 for yyp >= 0 {346 yyn = yyPact[yyS[yyp].yys] + yyErrCode347 if yyn >= 0 && yyn < yyLast {348 yystate = yyAct[yyn] /* simulate a shift of "error" */349 if yyChk[yystate] == yyErrCode {350 goto yystack351 }352 }353 /* the current p has no shift on "error", pop stack */354 if yyDebug >= 2 {355 __yyfmt__.Printf("error recovery pops state %d\n", yyS[yyp].yys)356 }357 yyp--358 }359 /* there is no state on the stack with an error shift ... abort */360 goto ret1361 case 3: /* no shift yet; clobber input char */362 if yyDebug >= 2 {363 __yyfmt__.Printf("error recovery discards %s\n", yyTokname(yytoken))364 }365 if yytoken == yyEofCode {366 goto ret1367 }368 yyrcvr.char = -1369 yytoken = -1370 goto yynewstate /* try again in the same state */371 }372 }373 /* reduction by production yyn */374 if yyDebug >= 2 {375 __yyfmt__.Printf("reduce %v in:\n\t%v\n", yyn, yyStatname(yystate))376 }377 yynt := yyn...

Full Screen

Full Screen

yyTokname

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 var jsonBlob = []byte(`[4 {"Name": "Platypus", "Order": "Monotremata"},5 {"Name": "Quoll", "Order": "Dasyuromorphia"}6 type Animal struct {7 }8 err := json.Unmarshal(jsonBlob, &animals)9 if err != nil {10 fmt.Println("error:", err)11 }12 fmt.Printf("%+v13}14import (15func main() {16 var jsonBlob = []byte(`[17 {"Name": "Platypus", "Order": "Monotremata"},18 {"Name": "Quoll", "Order": "Dasyuromorphia"}19 type Animal struct {20 }21 err := json.Unmarshal(jsonBlob, &animals)22 if err != nil {23 fmt.Println("error:", err)24 }25 fmt.Printf("%+v26}27import (28func main() {29 var jsonBlob = []byte(`[30 {"Name": "Platypus", "Order": "Monotremata"},31 {"Name": "Quoll", "Order": "Dasyuromorphia"}32 type Animal struct {33 }34 err := json.Unmarshal(jsonBlob, &animals)35 if err != nil {36 fmt.Println("error:", err)37 }38 fmt.Printf("%+v39}

Full Screen

Full Screen

yyTokname

Using AI Code Generation

copy

Full Screen

1func yyTokname(yys int) string {2 if yys >= 1 && yys-1 < len(yyToknames) {3 if yyToknames[yys-1] != "" {4 }5 }6 return __yyfmt__.Sprintf("tok-%v", yys)7}8func (yyj json) yyTok1(yys int) string {9 if yys >= 1 && yys-1 < len(yyToknames) {10 if yyToknames[yys-1] != "" {11 }12 }13 return __yyfmt__.Sprintf("tok-%v", yys)14}15func (yyj json) yyTok2(yys int) string {16 if yys >= 1 && yys-1 < len(yyToknames) {17 if yyToknames[yys-1] != "" {18 }19 }20 return __yyfmt__.Sprintf("tok-%v", yys)21}22func (yyj json) yyTok3(yys int) string {23 if yys >= 1 && yys-1 < len(yyToknames) {24 if yyToknames[yys-1] != "" {25 }26 }27 return __yyfmt__.Sprintf("tok-%v", yys)28}29func (yyj json) yyTok4(yys int) string {30 if yys >= 1 && yys-1 < len(yyToknames) {31 if yyToknames[yys-1] != "" {32 }33 }34 return __yyfmt__.Sprintf("tok-%v", yys)35}

Full Screen

Full Screen

yyTokname

Using AI Code Generation

copy

Full Screen

1func main() {2 fmt.Println(json.yyTokname(1))3}4func main() {5 fmt.Println(json.yyTokname(1))6}7func main() {8 fmt.Println(json.yyTokname(1))9}10func main() {11 fmt.Println(json.yyTokname(1))12}13func main() {14 fmt.Println(json.yyTokname(1))15}16func main() {17 fmt.Println(json.yyTokname(1))18}19func main() {20 fmt.Println(json.yyTokname(1))21}22func main() {23 fmt.Println(json.yyTokname(1))24}25func main() {26 fmt.Println(json.yyTokname(1))27}28func main() {29 fmt.Println(json.yyTokname(1))30}31func main() {32 fmt.Println(json.yyTokname(1))33}34func main() {35 fmt.Println(json.yyTokname(1))36}37func main() {38 fmt.Println(json.yyTokname(1))39}40func main() {41 fmt.Println(json.yyTokname(1))42}43func main() {44 fmt.Println(json.yyTokname(1))45}

Full Screen

Full Screen

yyTokname

Using AI Code Generation

copy

Full Screen

1import "fmt"2import "encoding/json"3type A struct {4}5func main() {6 a := A{1, 2}7 b, _ := json.Marshal(a)8 fmt.Println(string(b))9 fmt.Println(json.NewDecoder(b).Token())10}

Full Screen

Full Screen

yyTokname

Using AI Code Generation

copy

Full Screen

1import (2type json struct {3}4func (j *json) yyTokname(y int) string {5}6func main() {7 fmt.Println(j.yyTokname(2))8}9import (10type json struct {11}12func (j *json) yyTokname(y int) string {13}14func main() {15 fmt.Println(j.yyTokname(2))16}17import (18type json struct {19}20func (j *json) yyTokname(y int) string {21}22func main() {23 fmt.Println(j.yyTokname(2))24}25import (26type json struct {27}28func (j *json) yyTokname(y int) string {29}30func main() {31 fmt.Println(j.yyTokname(2))32}33import (34type json struct {35}36func (j *json) yyTokname(y int) string {37}38func main() {39 fmt.Println(j.yyTokname(2))40}41import (42type json struct {43}44func (j *json) yyTokname(y int) string {45}46func main() {47 fmt.Println(j.yyTokname(2))48}49import (50type json struct {51}52func (j *json) yyTokname(y int) string {53}54func main() {55 fmt.Println(j.yyTokname(2))56}57import (58type json struct {59}60func (j *json) yyTok

Full Screen

Full Screen

yyTokname

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 s = json.yyTokname(1)4 fmt.Println(s)5}6import (7func main() {8 s = json.yyTokname(1)9 fmt.Println(s)10}11import (12func main() {13 s = json.yyTokname(1)14 fmt.Println(s)15}16import (17func main() {18 s = json.yyTokname(1)19 fmt.Println(s)20}21import (22func main() {23 s = json.yyTokname(1)24 fmt.Println(s)25}26import (27func main() {28 s = json.yyTokname(1)29 fmt.Println(s)30}31import (32func main() {33 s = json.yyTokname(1)34 fmt.Println(s)35}36import (37func main() {38 s = json.yyTokname(1)39 fmt.Println(s)40}41import (42func main() {

Full Screen

Full Screen

yyTokname

Using AI Code Generation

copy

Full Screen

1import "fmt"2import "encoding/json"3import "strconv"4func main() {5 t.typ = int(tokenEOF)6 fmt.Println(t)7 fmt.Println(t.String())8 fmt.Println(t.yyTokname())9}10import "fmt"11import "encoding/json"12import "strconv"13func main() {14 t.typ = int(tokenEOF)15 fmt.Println(t)16 fmt.Println(t.String())17 fmt.Println(t.yyTokname())18}19import "fmt"20import "encoding/json"21import "strconv"22func main() {23 t.typ = int(tokenEOF)24 fmt.Println(t)25 fmt.Println(t.String())26 fmt.Println(t.yyTokname())27}28import "fmt"29import "encoding/json"30import "strconv"31func main() {32 t.typ = int(tokenEOF)33 fmt.Println(t)34 fmt.Println(t.String())35 fmt.Println(t.yyTokname())36}37import "fmt"38import "encoding/json"39import "strconv"40func main() {41 t.typ = int(tokenEOF)42 fmt.Println(t)43 fmt.Println(t.String())44 fmt.Println(t.yyTokname())45}46import "fmt"47import "encoding/json"48import "strconv"49func main() {50 t.typ = int(tokenEOF)51 fmt.Println(t)52 fmt.Println(t.String())53 fmt.Println(t.yyTokname())54}55import "fmt"56import "encoding/json"57import "strconv"58func main() {59 t.typ = int(tokenEOF)60 fmt.Println(t)61 fmt.Println(t.String())62 fmt.Println(t.yyTokname())63}

Full Screen

Full Screen

yyTokname

Using AI Code Generation

copy

Full Screen

1import (2func main() {3 json := json.NewJSON()4 fmt.Println(json.YyTokname(1))5}6import (7func main() {8 json := json.NewJSON()9 fmt.Println(json.YyTokname(2))10}11import (12func main() {13 json := json.NewJSON()14 fmt.Println(json.YyTokname(3))15}16import (17func main() {18 json := json.NewJSON()19 fmt.Println(json.YyTokname(4))20}21import (22func main() {23 json := json.NewJSON()24 fmt.Println(json.YyTokname(5))25}26import (27func main() {28 json := json.NewJSON()29 fmt.Println(json.YyTokname(6))30}31import (32func main() {33 json := json.NewJSON()34 fmt.Println(json.YyTokname(7))35}36import (

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful