Skip to content

Multiline comments break expression parsing #116

Open
@alex-tdrn

Description

@alex-tdrn

After upgrading to 0.1.10, the following memory.x file causes linking to fail:

MEMORY
{
  /* FLASH : ORIGIN = 0x00000000, LENGTH = 1024K
  RAM : ORIGIN = 0x20000000, LENGTH = 256K */

  /* These values correspond to the nRF52840 with Softdevices S140 7.3.0 */
  FLASH : ORIGIN = 0x00027000, LENGTH = 868K
  RAM : ORIGIN = 0x20020000, LENGTH = 128K
}

with:

thread 'main' panicked at ..\flip-link-0.1.10\src\main.rs:353:13:
          Failed to parse expression "256*1024 */" ("256*1024 */"), got error WrongOperatorArgumentAmount { expected: 2, actual: 1 }

The comment closing syntax gets confused for a multiplication operator, but only at the end of multiline comments.
The following memory.x links without issues:

MEMORY
{
  /* FLASH : ORIGIN = 0x00000000, LENGTH = 1024K */
  /* RAM : ORIGIN = 0x20000000, LENGTH = 256K */

  /* These values correspond to the nRF52840 with Softdevices S140 7.3.0 */
  FLASH : ORIGIN = 0x00027000, LENGTH = 868K
  RAM : ORIGIN = 0x20020000, LENGTH = 128K
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions