dialogos-project / dialogos

The DialogOS dialog system.
https://www.dialogos.app
GNU General Public License v3.0
21 stars 8 forks source link

enable list/dict access via square brackets in addtion to get/set() functions #190

Closed timobaumann closed 2 days ago

timobaumann commented 5 years ago

DialogOS script is missing the feature mentioned in the title that is found in most languages. This is due to limitations of its lexer/parser which makes constructions like:

| exp:list LEPAREN number:accessor REPAREN
        {: RESULT = parser.createFunctionCall("get", createList(accessor).append(list); :}

hard to implement. It would, of course, be awesome if someone were to try this nonetheless.

See e.g. https://stackoverflow.com/questions/53679890/reduce-reduce-conflict-in-cup

timobaumann commented 2 days ago

note that structs can already be get/set using dot-notation: struct.field. However, it's not possible to add elements to the struct in this way.

timobaumann commented 2 days ago

the changes are now documented in the Wiki.