[stringtemplate-interest] breath of life in python port
Terence Parr
parrt at cs.usfca.edu
Fri Jan 28 17:47:54 PST 2011
Hiya. From template:
' <x:{n | <foo()>}; separator=",">'
the python port prints correct AST, dumps correct bytecodes and almost correct stringtable (off by 1 error)
( (EXPR (: x (SUBTEMPLATE (ARGS n) (EXPR (INCLUDE foo)))) (OPTIONS (= separator ","))))
None:
0000: indent #1:x
0003: load_attr #2:"_sub1"
0006: new #3:,, 1
0011: map
0012: options
0013: load_str #4:<bad string index>
0016: store_option 4
0019: write_opt
0020: dedent
Strings:
0000:
0001: x
0002: "_sub1"
0003: ,
Bytecode to template map:
0003: 2..2 "x"
0006: 4..16 "{n | <foo()>}"
0011: 2..16 "x:{n | <foo()>}"
0013: 29..31 "",""
0016: 19..27 "separator"
0019: 1..32 "<x:{n | <foo()>}; separator=",">"
I'm getting somewhere!
Ter
PS woot!
More information about the stringtemplate-interest
mailing list