GithubHelp home page GithubHelp logo

Comments (8)

Nitcloud avatar Nitcloud commented on August 11, 2024 1

{
"name": "tcl",
"scopeName": "source.tcl",
"fileTypes": [
"tcl",
"xdc",
"sdc",
"fdc"
],
"uuid": "45aff42e-4fcd-4717-829b-4cdaf9d707aa",
"variables": null,
"patterns": [
{
"captures": {
"1": {
"name": "keyword.control.tcl"
}
},
"match": "(?<=^|[\[{;])\s*(if|while|for|catch|default|return|break|continue|switch|exit|foreach|try|throw)\b"
},
{
"include": "#comment"
},
{
"include": "#command"
}
],
"repository": {
"comment": {
"patterns": [
{
"name": "comment.line.tcl",
"match": "\s*\#.+"
}
]
},
"command": {
"patterns": [
{
"include": "#tcl_commands"
},
{
"include": "#default_command"
}
]
},
"expression": {
"patterns": [
{
"include": "#variable"
},
{
"include": "#brackets"
},
{
"name": "constant.numeric.tcl",
"match": "(?:0(?:x|o|b))?\d+(?!\.)"
},
{
"name": "constant.numeric.tcl",
"match": "\d+\.(?:\d+(?:[eE][+-]?\d+)?)?"
},
{
"name": "keyword.operator.tcl",
"match": "(?:\+|\-|\~|\!|\\|\|\%|\<\<|\>\>|\<\=|\>\=|\<|\>|\=\=|\!\=|eq|ne|in|ni|\&\&|\&|\|\||\||\^|\?|\:)"
}
]
},
"double_quotes": {
"patterns": [
{
"name": "string.quoted.double.tcl",
"begin": """,
"end": """,
"patterns": [
{
"include": "#variable"
}
]
}
]
},
"variable": {
"patterns": [
{
"begin": "(\$(?:(?:\:\:)?[a-zA-Z0-9_]+))\(",
"beginCaptures": {
"1": {
"name": "variable.other.tcl"
}
},
"end": "\)",
"patterns": [
{
"include": "#brackets"
},
{
"include": "#variable"
}
]
},
{
"name": "variable.other.tcl",
"match": "\$(?:(?:\:\:)?[a-zA-Z0-9_]+)"
},
{
"name": "variable.other.tcl",
"begin": "\$\{",
"end": "\}"
}
]
},
"braces": {
"patterns": [
{
"begin": "\{",
"end": "\}",
"patterns": [
{
"include": "#braces"
}
]
}
]
},
"tcl_braces": {
"patterns": [
{
"begin": "\{",
"end": "\}",
"patterns": [
{
"include": "#comment"
},
{
"include": "#command"
}
]
}
]
},
"expr_braces": {
"patterns": [
{
"begin": "\{",
"end": "\}",
"patterns": [
{
"include": "#expression"
}
]
}
]
},
"brackets": {
"patterns": [
{
"begin": "\[",
"end": "\]",
"patterns": [
{
"include": "#comment"
},
{
"include": "#command"
}
]
}
]
},
"proc": {
"patterns": [
{
"name": "meta.command.proc.tcl",
"begin": "(proc)",
"beginCaptures": {
"1": {
"name": "storage.type.function.tcl"
}
},
"end": "(?:(;)|(?=\})|(?=\])|$)",
"endCaptures": {
"1": {
"name": "punctuation.end.semicolon.tcl"
}
},
"patterns": [
{
"match": "(?:"([^\"]+)"|\{([^}]+)\}|([^\\{\\\"\\s]+)\b)\s
(?:"([^\"]+)"|\{([^}]+)\}|([^\\{\\\"\\s]+)\b)",
"captures": {
"1": {
"name": "entity.name.function.tcl"
},
"2": {
"name": "entity.name.function.tcl"
},
"3": {
"name": "entity.name.function.tcl"
},
"4": {
"name": "variable.parameter.tcl"
},
"5": {
"name": "variable.parameter.tcl"
},
"6": {
"name": "variable.parameter.tcl"
}
}
},
{
"include": "#double_quotes"
},
{
"include": "#brackets"
},
{
"include": "#tcl_braces"
}
]
}
]
},
"for": {
"patterns": [
{
"name": "meta.command.for.tcl",
"begin": "(for)",
"beginCaptures": {
"1": {
"name": "keyword.control.for.tcl"
}
},
"end": "(?:(;)|(?=\})|(?=\])|$)",
"endCaptures": {
"1": {
"name": "punctuation.end.semicolon.tcl"
}
},
"patterns": [
{
"begin": "(?=\{)(?=(?:.+?\{){3})",
"end": "(?<=\})",
"patterns": [
{
"include": "#tcl_braces"
}
]
},
{
"begin": "(?=\{)(?=(?:.+?\{){2})",
"end": "(?<=\})",
"patterns": [
{
"include": "#expr_braces"
}
]
},
{
"begin": "(?=\{)(?=(?:.+?\{){1})",
"end": "(?<=\})",
"patterns": [
{
"include": "#tcl_braces"
}
]
},
{
"begin": "(?=\{)",
"end": "(?<=\})",
"patterns": [
{
"include": "#tcl_braces"
}
]
},
{
"include": "#brackets"
},
{
"include": "#braces"
}
]
}
]
},
"if": {
"patterns": [
{
"name": "meta.command.for.tcl",
"begin": "(if)",
"beginCaptures": {
"1": {
"name": "keyword.control.if.tcl"
}
},
"end": "(?:(;)|(?=\})|(?=\])|$)",
"endCaptures": {
"1": {
"name": "punctuation.end.semicolon.tcl"
}
},
"patterns": [
{
"begin": "(?=\{)(?=(?:.+?\{))",
"end": "(?<=\})",
"patterns": [
{
"include": "#expr_braces"
}
]
},
{
"begin": "(?=\{)",
"end": "(?<=\})",
"patterns": [
{
"include": "#tcl_braces"
}
]
},
{
"include": "#brackets"
},
{
"include": "#braces"
}
]
}
]
},
"expr": {
"patterns": [
{
"name": "meta.command.expr.tcl",
"begin": "(expr)",
"beginCaptures": {
"1": {
"name": "support.function.expr.tcl"
}
},
"end": "(?:(;)|(?=\})|(?=\])|$)",
"endCaptures": {
"1": {
"name": "punctuation.end.semicolon.tcl"
}
},
"patterns": [
{
"include": "#expr_braces"
},
{
"include": "#expression"
}
]
}
]
},
"default_command": {
"patterns": [
{
"begin": "(\S+)",
"beginCaptures": {
"1": {
"name": "entity.name.function.tcl"
}
},
"end": "(?:(;)|(?=\})|(?=\])|$)",
"endCaptures": {
"1": {
"name": "punctuation.end.semicolon.tcl"
}
},
"patterns": [
{
"include": "#variable"
},
{
"include": "#double_quotes"
},
{
"include": "#brackets"
},
{
"include": "#braces"
}
]
}
]
},
"tcl_commands": {
"patterns": [
{
"include": "#proc"
},
{
"include": "#for"
},
{
"include": "#foreach"
},
{
"include": "#if"
},
{
"include": "#expr"
}
]
}
}
}

from digital-ide.

Nitcloud avatar Nitcloud commented on August 11, 2024

You can try changing the Tcl.json file to the above configuration

from digital-ide.

Nabav avatar Nabav commented on August 11, 2024

You can try changing the Tcl.json file to the above configuration

I have fixed the escape characters and tested. It is not working again, since the "foreach": entry is missing under "repository":. I do not know how to define the pattern characters for a new command.

from digital-ide.

Nabav avatar Nabav commented on August 11, 2024

@Bestduan, we need something like this, but it is not correct. Can you fix please?

    "foreach": {
      "patterns": [
        {
          "name": "meta.command.foreach.tcl",
          "begin": "(foreach)",
          "beginCaptures": {
            "1": {
              "name": "keyword.control.foreach.tcl"
            }
          },
          "end": "(?:(;)|(?=\\})|(?=\\])|$)",
          "endCaptures": {
            "1": {
              "name": "punctuation.end.semicolon.tcl"
            }
          },
          "patterns": [
            {
              "begin": "(?=\\{)(?=(?:.+?\\{))",
              "end": "(?<=\\})",
              "patterns": [
                {
                  "include": "#expr_braces"
                }
              ]
            },
            {
              "begin": "(?=\\{)",
              "end": "(?<=\\})",
              "patterns": [
                {
                  "include": "#tcl_braces"
                }
              ]
            },
            {
              "include": "#brackets"
            },
            {
              "include": "#braces"
            }
          ]
        }
      ]
    },

from digital-ide.

Nitcloud avatar Nitcloud commented on August 11, 2024

I have tried to fix it in the way you mentioned, but again it doesn't work, so I have added the following code to patterns so that we can highlight foreach. I am not familiar with the highlight grammar itself, and I just refer to the relevant design for reference.
{
"captures": {
"1": {
"name": "keyword.control.tcl"
}
},
"match": "(?<=^|[\[{;])\s*(if|while|for|catch|default|return|break|continue|switch|exit|foreach|try|throw)\b"
},

from digital-ide.

Nabav avatar Nabav commented on August 11, 2024

Then we can probably wait for a feedback from:
go2sh/tcl-language-support#2

Thanks for the support. ❤️

from digital-ide.

go2sh avatar go2sh commented on August 11, 2024

Hi, i fixed some of the highlighting especially foreach while for if/else break continue and some dict functions. Next step is to add try/trap/finally switch exit throw and lmap.

from digital-ide.

Nitcloud avatar Nitcloud commented on August 11, 2024

This issue has been addressed in the new version

from digital-ide.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.