Skip to content

Missing support for some operators in simplified AST #98

@willend

Description

@willend

I've stumbled upon an issue in mcstas-antlr related to the use of "not equal" in WHEN clauses:
(Have no idea if the issue is specific to WHEN or could arise elsewhere)

2025-01-28 11:43:04.424 | ERROR   | mccode_antlr.reader.reader:syntaxError:26 - Syntax error in parsing Instrument /Users/peterwillendrup/Projects/dmsc-instrumentmodels/estia/mcstas-polarizer/simulation/Estia_baseline.instr at 255,17
2025-01-28 11:43:04.424 | INFO    | mccode_antlr.reader.reader:syntaxError:31 - 
2025-01-28 11:43:04.424 | INFO    | mccode_antlr.reader.reader:syntaxError:31 - /* The actual virtual source mask, two L-shaped absorbers (first top-right) */
2025-01-28 11:43:04.424 | INFO    | mccode_antlr.reader.reader:syntaxError:31 - COMPONENT virtual_source_TR = Slit(
2025-01-28 11:43:04.424 | INFO    | mccode_antlr.reader.reader:syntaxError:31 -   xmin = 0.0, xmax = 1.0, ymin = -1.0, ymax = sample_height/2+over_illumination*5)
2025-01-28 11:43:04.424 | INFO    | mccode_antlr.reader.reader:syntaxError:31 -   WHEN (sample != 4) AT (-over_illumination, 0, -0.5*sample_length) RELATIVE arm_virtual_source
2025-01-28 11:43:04.424 | ERROR   | mccode_antlr.reader.reader:syntaxError:32 - ~~~~~~~~~~~~~~~~~^ mismatched input '!=' expecting ')'
2025-01-28 11:43:04.425 | INFO    | mccode_antlr.reader.reader:syntaxError:34 - 
2025-01-28 11:43:04.425 | INFO    | mccode_antlr.reader.reader:syntaxError:34 - // window to cut down to defined size for test setting
2025-01-28 11:43:04.428 | ERROR   | mccode_antlr.reader.reader:syntaxError:26 - Syntax error in parsing Instrument /Users/peterwillendrup/Projects/dmsc-instrumentmodels/estia/mcstas-polarizer/simulation/Estia_baseline.instr at 265,17
2025-01-28 11:43:04.428 | INFO    | mccode_antlr.reader.reader:syntaxError:31 - //   
2025-01-28 11:43:04.428 | INFO    | mccode_antlr.reader.reader:syntaxError:31 - /* The actual virtual source mask, two L-shaped absorbers (second bottom-left) */
2025-01-28 11:43:04.428 | INFO    | mccode_antlr.reader.reader:syntaxError:31 - COMPONENT virtual_source_BL = Slit(
2025-01-28 11:43:04.428 | INFO    | mccode_antlr.reader.reader:syntaxError:31 -   xmin = -1.0, xmax = 0.0, ymin = -sample_height/2-over_illumination*5, ymax = 1.0)
2025-01-28 11:43:04.428 | INFO    | mccode_antlr.reader.reader:syntaxError:31 -   WHEN (sample != 4) AT (over_illumination, 0, 0.5*sample_length) RELATIVE arm_virtual_source
2025-01-28 11:43:04.428 | ERROR   | mccode_antlr.reader.reader:syntaxError:32 - ~~~~~~~~~~~~~~~~~^ mismatched input '!=' expecting ')'

Version info for mcode-antlr, installed via conda-forge:

(base) yada: $ mcstas-antlr -v
mccode_antlr code generator version 0.9.2
 Copyright (c) European Spallation Source ERIC, 2023-2024
Based on McStas/McXtrace version 3
 Copyright (c) DTU Physics and Risoe National Laboratory, 1997-2023
 Additions (c) Institut Laue Langevin, 2003-2019
All rights reserved

Components are (c) their authors, see component headers.
(base) yada: $ mamba search mccode-antlr
Getting repodata from channels...

mantid/noarch                    ??.?MB @ ??.?MB/s 0.3s
conda-forge/osx-arm64                14.1MB @ 29.4MB/s 0.4s
conda-forge/noarch                 18.8MB @ 34.4MB/s 0.5s
nodefaults/osx-arm64                125.0 B @ 523.0 B/s 0.2s
nodefaults/noarch                  ??.?MB @ ??.?MB/s 0.6s
mantid/osx-arm64                  125.0 B @ 47.0 B/s 2.6s
 Name     Version Build     Channel   Subdir   
─────────────────────────────────────────────────────────────
 mccode-antlr 0.9.2  pyh4b9e410_0  conda-forge conda-forge

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