java icon indicating copy to clipboard operation
java copied to clipboard

DSL: Add support for end of line comments

Open chipbite opened this issue 1 year ago • 4 comments

Description

Hello! The comment on line 11 yields a parsing error (// this comment yields error). I think it should not, or?

Steps to reproduce

  1. Save code, and
  2. render it using structurizr CLI

Screenshot

No response

Code sample

workspace  {

    # directive to set all identifiers to be hierarchical
    !identifiers hierarchical 
    model {
        asystem = softwareSystem "System A" {
            fun1 = container "Container Fun 1"
        }
        bsystem = softwareSystem "System B" {
            joy1 = container "Container Joy 1"
            -> asystem "Callback" // this comment yields error
        }

        asystem -> bsystem "Calls" // works.
        asystem.fun1 -> bsystem.joy1

    }

    views {
        container bsystem "containers_sys_B" {
            include *
            autolayout lr
        }
    }

}

Configuration

C:\Users\mawid6>structurizr.bat version
structurizr-cli: 1.33.1
structurizr-java: 1.26.1
structurizr-dsl: 1.32.0
structurizr-export: 1.16.1
structurizr-import: v1.5.0
Java: 17.0.9/Microsoft (C:\Program Files\Microsoft\jdk-17.0.9.8-hotspot)
OS: Windows 10 10.0 (amd64)

Severity

Minor

Priority

I have no budget and there's no rush, please fix this for free

More information

Error is:

Exporting workspace from C:\code\c4-demo-stuff\test-c4.dsl
 - loading workspace from DSL
com.structurizr.dsl.StructurizrDslParserException: Too many tokens, expected: -> <identifier> [description] [technology] [tags] at line 11 of C:\code\c4-demo-stuff\test-c4.dsl: -> asystem "Callback" // not working
        at com.structurizr.dsl.StructurizrDslParser.parse(StructurizrDslParser.java:912)
        at com.structurizr.dsl.StructurizrDslParser.parse(StructurizrDslParser.java:128)
        at com.structurizr.cli.export.ExportCommand.run(ExportCommand.java:131)
        at com.structurizr.cli.StructurizrCliApplication.run(StructurizrCliApplication.java:81)
        at com.structurizr.cli.StructurizrCliApplication.main(StructurizrCliApplication.java:119)

chipbite avatar Jan 23 '24 09:01 chipbite

End of line comments are not currently supported I'm afraid. I've tagged the issue as an enhancement, but I have no plans to add support any time soon.

simonbrowndotje avatar Jan 23 '24 14:01 simonbrowndotje

End of line comment works at line 14 in the same sample.

That is why I thought it would work. But its certainly a nitpick, there are bigger fishes to fry. 😊

chipbite avatar Jan 23 '24 14:01 chipbite

End of line comment works at line 14 in the same sample.

It doesn't. 😀

image

simonbrowndotje avatar Jan 23 '24 15:01 simonbrowndotje

Ahh, of course, foolish of me - I was sloppy when reviewing the results. Apologies! Thanks for taking the time to clarify Simon!

chipbite avatar Jan 24 '24 09:01 chipbite