code : interpolant """ add_interpolant( lexer = p.lexer, fmt = p[1].fmt, arg = p[1].arg, ) def p_error(p): p.lexer.module.throw( err.string_format_error, line = p.lineno, position = p.lexpos, ) parser = pyacc(tabmodule = 'fml_parsetab') def yacc(module, source): lexer = Lexer(module) if module.verbose.fml: module.verbose_tag('fml: yacc') parser.parse( source, lexer = lexer, debug = module.verbose.fml, ) return lexer.fmt, lexer.args
| namex | numberx | opx | commax | interpolationx """ p[0] = p[1] precedence = ( ('left', l.semix,), ('left' , l.opx,), ('left', l.bdotx,), ('right', l.udotx,), ) def p_error(p): p.value.throw(err.syntax_error, lexem=repr(p.value.value)) parser = pyacc(tabmodule = 'yacc_parsetab') def yacc(module): if module.verbose.yacc: module.verbose_tag('module yacc') code = parser.parse( module.source, lexer = module, debug = module.verbose.yacc, ) module.code = code.linecod
p[0] = p[1] + p[2] def p_ket(p): """ ket : ketR rket """ p[0] = p[1] + p[2] def p_error(p): p.lexer.module.throw( error_type = err.unbalanced_parenthesis, line = p.lineno, position = p.lexpos, ) parser = pyacc(tabmodule = 'mark_newlinex_parsetab') def mark_newlinex(module): lexer = main_lexer.clone() lexer.module = module lexer.group = 0 source = '<bofx>' + module.source + '\n<eofx>' # make sure eof is smooth if module.verbose.mark_newlinex: module.verbose_tag('mark newlinex: lex') lexer.input(source) t = lexer.token() while t: print(t.type, repr(t.value), t.lineno, t.lexpos) t = lexer.token() print()