Skip to content
This repository has been archived by the owner on Sep 25, 2018. It is now read-only.

incorrect line and column numbers #373

Open
mattoshry opened this issue Jun 28, 2016 · 2 comments
Open

incorrect line and column numbers #373

mattoshry opened this issue Jun 28, 2016 · 2 comments

Comments

@mattoshry
Copy link
Collaborator

Running the following document through scxml-to-scjson:

<scxml xmlns="http://www.w3.org/2005/07/scxml"
  version="1.0"
  initial="s1">

<datamodel>
  <data id="counter"
    expr="0"/>
</datamodel>

<state id="s1">
  <transition target="pass"/>
</state>

<final id="pass"/>

</scxml>

yields the following {local.name, line, and column}:

onopentag scxml 2 15
onopentag datamodel 4 11
onopentag data 6 14
onopentag state 9 15
onopentag transition 10 29
onopentag final 13 18

Intuitively one would expect the line and column to reflect the location of the beginning of the start tag:

onopentag scxml 1 8
onopentag datamodel 5 12
onopentag data 6 9
onopentag state 10 8
onopentag transition 11 15
onopentag final 14 8

There are a couple of issues here:

  1. The SAX module provides line and column info using offset 0.
  2. The SAX module updates the line and column when it encounters a \n which, as demonstrated in the above example, may occur before the onopentag event is emitted after all the attributes of the tag are consumed.
@mattoshry
Copy link
Collaborator Author

The fix is to hook the onopentagstart event and track the state of the line and column for use when the onopentag event fires.

@jbeard4
Copy link
Owner

jbeard4 commented Jun 23, 2018

@mattoshry Please try this again. SCION is now using a custom version of sax-js with better parsing behavior.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants