Skip to content

v0.5.13

Compare
Choose a tag to compare
@hydroper hydroper released this 25 Apr 11:36
· 111 commits to master since this release

Error recovery

  • Mostly non-greedy expectations
  • Subsequent sections of expectation error are ignored
// 1:3: Expecting either a semicolon or a new line here.
aNS aNS

// OK
aNS function f() {}

// 1:5: Duplicate access modifier.
aNS aNS function f() {}

// 2:11: Expecting identifier before close-parenthesis.
// 3:11: Expecting identifier before close-parenthesis.
switch type (v) {
    case () {}
    case () {}
}

Problem messages

The problem messages and the token names match a bit more of these in ASC 2.0, turning out more elegant.

Function bodies

function bodies consisting of an expression now have an additional indentation rule for avoiding conflict with expressions not belonging to the body, such as for native and abstract methods. The recommendation is for function definitions consisting of an expression body to use a "trailing" semicolon to prevent meta-data mistreated as a computed member.

Location enhancements

  • ASDoc comment locations now span from the boundaries of the delimiters.

MXML

  • Attributes consisting of more than one colon report an error.
  • xmlns and xmlns: attributes are traversed before all other attributes.

Bug fixes

  • InputElementXMLTag was having a possible infinite loop due to not including an end-of-file token.
  • Processing instruction in MXML was mishandled. It was not reporting errors properly for the attributes.

Forgeries

The following forgeries were resolved:

  • The version 0.4 of this parser was a port of another parser of my another project that changed considerably. The same parser of that other project was based on the version 0.3 of this same parser, which changed totally. I had forgot to remove certain things, such as the @event ASDoc tag which does not exist (only @eventType exists).
  • There was an ASDoc tag (@eventType) that receives an ActionScript 3 reference that I forgot to parse correctly.

Rust changes

Now the various static methods of the Attribute structure that take a list of attributes take them as a &[T] borrow rather than a &Vec<T> borrow.

Demo

Now the demo has an "Source Form" option allowing to parse input as either ActionScript 3 or MXML. In the future, CSS may be included.

The MXML tree includes namespace mappings which are hidden in the output tree.

image