Wiki

Ticket #283 (assigned defect)

Opened 12 years ago

Last modified 11 years ago

Parser error regarding multi-line collection literals

Reported by: Charles Owned by: Chuck
Priority: medium Milestone:
Component: Cobra Compiler Version: 0.8.0
Keywords: parser Cc:

Description

The following program produces a false error from the parser:

class A

    var t = [
            0, 1, 3
        ]

    var obj as Object

    def main
        pass

x-parser-problem.cobra(7,1): error: Expecting use, assembly, namespace, class, interface or enum, but got "var".

It doesn't matter if the literal is a list or array. Until there is a fix, the workaround is to put the closing bracket (]) on the same level as the starting var.

Attachments

indent-lit.patch Download (3.4 KB) - added by hopscc 11 years ago.

Change History

Changed 11 years ago by hopscc

INDENT token from indented list literal (terminator) forces a corresponding dedent after the literal terminator that is never cleaned up.
Its picked up at a higher level pushing the parser processing out a level.

Needs a corresponding call to finishSpaceAgnostic and some fixup for a swallowed EOLn.

This refers to List but happens for Arrays, Dict and Set literals as well.

Changed 11 years ago by hopscc

Changed 11 years ago by hopscc

  • owner set to Chuck
  • status changed from new to assigned

Code patch and tests for a list lit, array, Dict and Set.

Note: See TracTickets for help on using tickets.