Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added positional offsets to each YangStatement #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/yang-parser.litcoffee
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,21 @@ The result of the `statement` parser is an initialized `YangStatement`
object. If no argument is present, the object's `arg` property is set
to `false`.

statement = keyword.bind (kw) ->
rawStatement = keyword.bind (kw) ->
(sep.bind -> argument).option(false).bind (arg) ->
strict = true if kw[1] is 'yang-version' and arg is '1.1'
optSep.bind -> semiOrBlock.bind (sst) ->
P.unit new YangStatement kw[0], kw[1], arg, sst

statement = new P (offset) ->
res = rawStatement.pf offset

if res[0] != null
res[0].sp = offset
res[0].ep = res[1]

res

A statement block is a sequence of statements enclosed in
braces. Whitespace or comments are permitted before or after any
statement in the block.
Expand Down