Slide 84
Slide 84 text
&SSPS5PMFSBODFPG1SJTN
$ ruby -rprism -e 'p Prism.parse("(42)").value'
@ ProgramNode (location: (1,0)-(1,4))
βββ locals: []
βββ statements:
@ StatementsNode (location: (1,0)-(1,4))
βββ body: (length: 1)
βββ @ ParenthesesNode (location: (1,0)-(1,4))
βββ body:
β @ StatementsNode (location: (1,1)-(1,3))
β βββ body: (length: 1)
β βββ @ IntegerNode (location: (1,1)-(1,3))
β βββ flags: decimal
β βββ value: 42
βββ opening_loc: (1,0)-(1,1) = "("
βββ closing_loc: (1,3)-(1,4) = ")"
$ ruby -rprism -e 'p Prism.parse("(42").value'
@ ProgramNode (location: (1,0)-(1,3))
βββ locals: []
βββ statements:
@ StatementsNode (location: (1,0)-(1,3))
βββ body: (length: 1)
βββ @ ParenthesesNode (location: (1,0)-(1,3))
βββ body:
β @ StatementsNode (location: (1,1)-(1,3))
β βββ body: (length: 2)
β βββ @ IntegerNode (location: (1,1)-(1,3))
β β βββ flags: decimal
β β βββ value: 42
β βββ @ MissingNode (location: (1,1)-(1,3))
βββ opening_loc: (1,0)-(1,1) = "("
βββ closing_loc: (1,3)-(1,3) = ""
Parse the valid syntax (42) Parse the invalid syntax (42
8IFOQBSTJOHJOWBMJETZOUBY
/0&3303PDDVST
BOEBMissingNodeJTJOTFSUFEJOTUFBE