[e-lang] Bug (0.8.37g and earlier): parsing with no trailing newline has strange results

Kevin Reid kpreid at mac.com
Wed Dec 6 08:56:18 CST 2006


? def eParser := <elang:syntax.makeEParser>
# value: <makeEParser>

? eParser("?foo")
# value: e`o`

? eParser(">foo")
# value: e`o`

? eParser("?foo1")
# value: e`1`

? eParser("foo +")
# problem: <NullPointerException>

? eParser("\"")
# problem: <NullPointerException>

? eParser("def x :=")
# problem: <NullPointerException>

? eParser("x =~ \n?foo_")
# value: e`escape ej__1 {
#            def _ exit ej__1 := x
#            true
#        } catch _ {
#            false
#        }`

This category of problems occurs when the text being parsed does not  
end with a newline.

I had previously believed that it always produced a  
NullPointerException, but the other cases above are misparses which  
could lead to quite confusing behavior vs. the apparent meaning of  
the source.

This also leads to confusing behavior of the evaluator IRC bot, since  
the errors or parses have little visible relation to the input.

-- 
Kevin Reid                            <http://homepage.mac.com/kpreid/>




More information about the e-lang mailing list