Fork me on GitHub
#instaparse
<
2017-04-03
>
wistb20:04:14

@aengelberg , I am trying instaparse against an IETF abnf (https://tools.ietf.org/html/rfc7950 ). I am getting the error Parse error at line 92, column 44: < URI in RFC 3986 >

wistb20:04:56

and this is what I see at that location

wistb20:04:57

uri-str = < a string that matches the rule > < URI in RFC 3986 >

aengelberg20:04:37

< a string that matches the rule > isn't valid BNF. In that spec, it is used for prose that can only be understood by humans.

aengelberg20:04:01

In Instaparse we use <abc> completely differently, used to refer to the "hidden" version of the non-terminal abc.

wistb21:04:01

thank you @aengelberg . I made a change and the parsing moved forward. Now, I am getting an error (in the last few pages of the grammar file, So, I am hoping the grammar is holding up well so far)

wistb21:04:03

CompilerException java.lang.RuntimeException: Error parsing grammar specification: Parse error at line 915, column 32: action-keyword = %s"action"

wistb21:04:28

I think the ietf doc wants to use 'non case sensitive' form.

aengelberg21:04:53

I don't think %s is valid ABNF per the spec, though I see what it's getting at, and it wouldn't be too hard to implement.

aengelberg21:04:34

If you're ok with case insensitive, you could just do "action"

wistb21:04:41

@aengelberg for now, I removed %s and moved on. It is getting close to the end of the file, but, I have this error :

aengelberg21:04:46

If you really want case sensitive, you could translate it to decimal or hex and use %d / %x

aengelberg21:04:58

You're going to want :input-format :abnf if you haven't set that already btw

wistb21:04:41

CompilerException java.lang.RuntimeException: a occurs on the right-hand side of your grammar, but not on the left,

wistb21:04:16

I am invoking , like so,

wistb21:04:17

(def my-parser (insta/parser (http://clojure.java.io/resource "my.abnf") :input-format :abnf :trace true))

wistb21:04:21

But, this time, I don't know which particular text is the culprit.

aengelberg21:04:32

Only thing I can think of is there is a loose a or A somewhere...

aengelberg21:04:09

Or it's one of the < a string that matches the rule >

aengelberg21:04:16

and the a is the first of many invalid things in that expression.

wistb21:04:14

Let me see. I removed those kind of usages. May be there is still something lurking ..

wistb21:04:32

@aengelberg .. great . that is the issue. one such usage got left out. I changed it, now, that parsing is completing without error. Thank you.

wistb21:04:13

I am not sure about the change I made (I dont know much about grammars), though .. I changed the text from yang-version-arg-str = < a string that matches the rule > < yang-version-arg > to yang-version-arg-str = yang-version-arg yang-version-arg = "1.1"

wistb21:04:05

if that is correct, I wonder why the ietf folks did not do the same. As it is , the ietf abnf is not parseable, right.

aengelberg21:04:03

I think some grammars are written with the intention of helping humans to write programs, rather than to be fed to parser generators like Instaparse.

aengelberg21:04:14

So they don't feel the need to exactly follow the ABNF spec.