Changeset aa7a56e


Ignore:
Timestamp:
Mar 30, 2020, 6:26:31 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
a685335
Parents:
a768220
Message:

Added declaration constants and operators, none particularly robust

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tools/vscode/uwaterloo.cforall-0.1.0/syntaxes/cfa.tmLanguage.json

    ra768220 raa7a56e  
    55                { "include": "#preprocessor"},
    66                { "include": "#extern"},
    7                 { "include": "#test"}
     7                { "include": "#declaration"},
     8                { "include": "#constant"},
     9                { "include": "#operators"}
    810        ],
    911        "repository": {
    10                 "directive.punctuation": {
    11                         "match": "#",
    12                         "name": "punctuation.definition.directive.cfa"
    13                 },
    14                 "directive.pragma": {
    15                         "name": "meta.preprocessor.pragma.cfa",
    16                         "match": "^\\s*(#\\s*pragma)\\s+(((?!//|/\\*).)*)",
    17                         "captures":{
    18                                 "1": {
    19                                         "name": "keyword.control.directive.pragma.cfa",
    20                                         "patterns":[{ "include": "#directive.punctuation"} ]
    21                                 },
    22                                 "2": {"name": "keyword.control.directive.pragma.argument.cfa"}
    23                         }
    24                 },
    25                 "directive.include.string": {
    26                         "begin": "<|\"",
    27                         "end": ">|\"",
    28                         "beginCaptures": {
    29                                 "0": { "name": "punctuation.definition.string.begin.cfa" }
    30                         },
    31                         "endCaptures": {
    32                                 "0": { "name": "punctuation.definition.string.end.cfa" }
    33                         },
    34                         "name": "string.quoted.include.cfa"
    35                 },
    36                 "directive.include": {
    37                         "name": "meta.preprocessor.include.cfa",
    38                         "match": "^\\s*(#\\s*include)\\s+(<.*>|\".*\")",
    39                         "captures": {
    40                                 "1": {
    41                                         "name": "keyword.control.directive.include.cfa",
    42                                         "patterns":[{ "include": "#directive.punctuation"} ]
    43                                 },
    44                                 "2": {"patterns": [{ "include": "#directive.include.string"}]}
    45                         }
    46                 },
    47                 "directive.macro.name": {
    48                         "name": "entity.name.function.preprocessor.cfa",
    49                         "match": "[A-z0-9_]+"
    50                 },
    51                 "directive.define": {
    52                         "name": "meta.preprocessor.macro.cfa",
    53                         "match": "^\\s*(#\\s*define)\\s+([A-z0-9_]+)(\\(.*\\))?\\s+(.*)?",
    54                         "captures": {
    55                                 "1": {
    56                                         "name": "keyword.control.directive.define.cfa",
    57                                         "patterns":[{ "include": "#directive.punctuation"} ]
    58                                 },
    59                                 "2": {"patterns": [{ "include": "#directive.macro.name"}]},
    60                                 "3": {"name":"meta.define.C"},
    61                                 "4": {"name":"meta.define.D"}
    62                         }
    63                 },
    64                 "directive.undef": {
    65                         "name": "meta.preprocessor.macro.cfa",
    66                         "match": "^\\s*(#\\s*undef)\\s+([A-z0-9_]+)",
    67                         "captures": {
    68                                 "1": {
    69                                         "name": "keyword.control.directive.undef.cfa",
    70                                         "patterns":[{ "include": "#directive.punctuation"} ]
    71                                 },
    72                                 "2": {"name":"meta.define.B", "patterns": [{ "include": "#directive.macro.name"}]}
    73                         }
    74                 },
    75                 "directive.isdef": {
    76                         "match": "(defined)\\s*\\(\\s*([A-z0-9_]+)\\s*\\)",
    77                         "captures": {
    78                                 "1": {
    79                                         "name": "keyword.control.directive.conditional.cfa",
    80                                         "match": "defined"
    81                                 },
    82                                 "2": {"patterns": [{ "include": "#directive.macro.name"}]}
    83                         }
    84                 },
    85                 "directive.ifdef": {
    86                         "name": "meta.preprocessor.cfa",
    87                         "match": "^\\s*(#\\s*ifdef)\\s+([A-z0-9_]+)",
    88                         "captures": {
    89                                 "1": {
    90                                         "name": "keyword.control.directive.conditional.cfa",
    91                                         "patterns":[{ "include": "#directive.punctuation"} ]
    92                                 },
    93                                 "2": {"patterns": [{ "include": "#directive.macro.name"}]}
    94                         }
    95                 },
    96                 "directive.condition.arg": {
    97                         "name": "meta.preprocessor.cfa",
    98                         "match": "^\\s*(#\\s*if|#\\s*elif)\\s+(.*)",
    99                         "captures": {
    100                                 "1": {
    101                                         "name": "keyword.control.directive.conditional.cfa",
    102                                         "patterns":[{ "include": "#directive.punctuation"} ]
    103                                 },
    104                                 "2": {"patterns":[
    105                                         { "include": "#expression"},
    106                                         { "include": "#directive.isdef"}
    107                                 ]}
    108                         }
    109                 },
    110                 "directive.condition.noargs": {
    111                         "name": "meta.preprocessor.cfa",
    112                         "match": "^\\s*(#\\s*endif|#\\s*else)\\s+",
    113                         "captures": {
    114                                 "1": {
    115                                         "name": "keyword.control.directive.conditional.cfa",
    116                                         "patterns":[{ "include": "#directive.punctuation"} ]
    117                                 }
    118                         }
    119                 },
    12012                "preprocessor": {
    12113                        "patterns":[
     
    12719                                { "include": "#directive.condition.arg" },
    12820                                { "include": "#directive.condition.noargs" }
    129                         ]
    130                 },
    131                 "comments.line":{
    132                         "name": "comment.line.double-slash.cfa",
    133                         "match": "(\/\/).*",
    134                         "captures": {
    135                                 "1": {"name": "punctuation.definition.comment.c", "match": "\/\/"}
    136                         }
    137                 },
    138                 "comments.block":{
    139                         "name": "comment.block.cfa",
    140                         "begin": "/\\*",
    141                         "end": "\\*/",
    142                         "beginCaptures": {
    143                                 "0": { "name": "punctuation.definition.comment.begin.cfa" }
    144                         },
    145                         "endCaptures": {
    146                                 "0": { "name": "punctuation.definition.comment.end.cfa" }
     21                        ],
     22                        "repository": {
     23                                "directive.punctuation": {
     24                                        "match": "#",
     25                                        "name": "punctuation.definition.directive.cfa"
     26                                },
     27                                "directive.pragma": {
     28                                        "name": "meta.preprocessor.pragma.cfa",
     29                                        "match": "^\\s*(#\\s*pragma)\\s+(((?!//|/\\*).)*)",
     30                                        "captures":{
     31                                                "1": {
     32                                                        "name": "keyword.control.directive.pragma.cfa",
     33                                                        "patterns":[{ "include": "#directive.punctuation"} ]
     34                                                },
     35                                                "2": {"name": "keyword.control.directive.pragma.argument.cfa"}
     36                                        }
     37                                },
     38                                "directive.include.string": {
     39                                        "begin": "<|\"",
     40                                        "end": ">|\"",
     41                                        "beginCaptures": {
     42                                                "0": { "name": "punctuation.definition.string.begin.cfa" }
     43                                        },
     44                                        "endCaptures": {
     45                                                "0": { "name": "punctuation.definition.string.end.cfa" }
     46                                        },
     47                                        "name": "string.quoted.include.cfa"
     48                                },
     49                                "directive.include": {
     50                                        "name": "meta.preprocessor.include.cfa",
     51                                        "match": "^\\s*(#\\s*include)\\s+(<.*>|\".*\")",
     52                                        "captures": {
     53                                                "1": {
     54                                                        "name": "keyword.control.directive.include.cfa",
     55                                                        "patterns":[{ "include": "#directive.punctuation"} ]
     56                                                },
     57                                                "2": {"patterns": [{ "include": "#directive.include.string"}]}
     58                                        }
     59                                },
     60                                "directive.macro.name": {
     61                                        "name": "entity.name.function.preprocessor.cfa",
     62                                        "match": "[A-z0-9_]+"
     63                                },
     64                                "directive.define": {
     65                                        "name": "meta.preprocessor.macro.cfa",
     66                                        "match": "(#\\s*define)\\s+([A-z0-9_]+)(\\(.*\\))?\\s+(.*)?",
     67                                        "captures": {
     68                                                "1": {
     69                                                        "name": "keyword.control.directive.define.cfa",
     70                                                        "patterns":[{ "include": "#directive.punctuation"} ]
     71                                                },
     72                                                "2": {"patterns": [{ "include": "#directive.macro.name"}]},
     73                                                "3": {"name":"meta.preprocessor.macro.args.cfa"},
     74                                                "4": {"name":"meta.preprocessor.macro.definition.cfa", "patterns": [{ "include": "$self" }]}
     75                                        }
     76                                },
     77                                "directive.undef": {
     78                                        "name": "meta.preprocessor.macro.cfa",
     79                                        "match": "^\\s*(#\\s*undef)\\s+(\\w+)",
     80                                        "captures": {
     81                                                "1": {
     82                                                        "name": "keyword.control.directive.undef.cfa",
     83                                                        "patterns":[{ "include": "#directive.punctuation"} ]
     84                                                },
     85                                                "2": {"name":"meta.define.B", "patterns": [{ "include": "#directive.macro.name"}]}
     86                                        }
     87                                },
     88                                "directive.isdef": {
     89                                        "match": "(defined)\\s*\\(\\s*(\\w+)\\s*\\)",
     90                                        "captures": {
     91                                                "1": {
     92                                                        "name": "keyword.control.directive.conditional.cfa",
     93                                                        "match": "defined"
     94                                                },
     95                                                "2": {"patterns": [{ "include": "#directive.macro.name"}]}
     96                                        }
     97                                },
     98                                "directive.ifdef": {
     99                                        "name": "meta.preprocessor.cfa",
     100                                        "match": "^\\s*(#\\s*ifdef)\\s+(\\w+)",
     101                                        "captures": {
     102                                                "1": {
     103                                                        "name": "keyword.control.directive.conditional.cfa",
     104                                                        "patterns":[{ "include": "#directive.punctuation"} ]
     105                                                },
     106                                                "2": {"patterns": [{ "include": "#directive.macro.name"}]}
     107                                        }
     108                                },
     109                                "directive.condition.arg": {
     110                                        "name": "meta.preprocessor.cfa",
     111                                        "match": "^\\s*(#\\s*if|#\\s*elif)\\s+(.*)",
     112                                        "captures": {
     113                                                "1": {
     114                                                        "name": "keyword.control.directive.conditional.cfa",
     115                                                        "patterns":[{ "include": "#directive.punctuation"} ]
     116                                                },
     117                                                "2": {"patterns":[
     118                                                        { "include": "#expression"},
     119                                                        { "include": "#directive.isdef"}
     120                                                ]}
     121                                        }
     122                                },
     123                                "directive.condition.noargs": {
     124                                        "name": "meta.preprocessor.cfa",
     125                                        "match": "^\\s*(#\\s*endif|#\\s*else)\\s+",
     126                                        "captures": {
     127                                                "1": {
     128                                                        "name": "keyword.control.directive.conditional.cfa",
     129                                                        "patterns":[{ "include": "#directive.punctuation"} ]
     130                                                }
     131                                        }
     132                                }
    147133                        }
    148134                },
     
    151137                                { "include": "#comments.line"},
    152138                                { "include": "#comments.block"}
     139                        ],
     140                        "repository": {
     141                                "comments.line":{
     142                                        "name": "comment.line.double-slash.cfa",
     143                                        "match": "(\/\/).*",
     144                                        "captures": {
     145                                                "1": {"name": "punctuation.definition.comment.c", "match": "\/\/"}
     146                                        }
     147                                },
     148                                "comments.block":{
     149                                        "name": "comment.block.cfa",
     150                                        "begin": "/\\*",
     151                                        "end": "\\*/",
     152                                        "beginCaptures": {
     153                                                "0": { "name": "punctuation.definition.comment.begin.cfa" }
     154                                        },
     155                                        "endCaptures": {
     156                                                "0": { "name": "punctuation.definition.comment.end.cfa" }
     157                                        }
     158                                }
     159                        }
     160                },
     161                "extern": {
     162                        "patterns": [{ "include": "#extern.block"}],
     163                        "repository": {
     164                                "extern.head.string": {
     165                                        "begin": "\"",
     166                                        "end": "\"",
     167                                        "beginCaptures": {
     168                                                "0": { "name": "punctuation.definition.string.begin.cfa" }
     169                                        },
     170                                        "endCaptures": {
     171                                                "0": { "name": "punctuation.definition.string.end.cfa" }
     172                                        },
     173                                        "name": "string.quoted.extern.cfa"
     174                                },
     175                                "extern.head": {
     176                                        "match": "(extern)\\s+(.*)\\s+(\\{)",
     177                                        "captures": {
     178                                                "1": { "name": "storage.modifier.cfa" },
     179                                                "2": { "patterns":[{ "include": "#extern.head.string"}] },
     180                                                "3": { "name": "punctuation.section.block.begin.bracket.curly.extern.cfa" }
     181                                        }
     182                                },
     183                                "extern.block": {
     184                                        "name": "meta.block.extern.cfa",
     185                                        "begin": "(extern\\s+.*\\s+\\{)",
     186                                        "end": "(\\})",
     187                                        "beginCaptures": {
     188                                                "0": { "name": "meta.head.extern.cfa", "patterns":[{ "include": "#extern.head" }] }
     189                                        },
     190                                        "endCaptures": {
     191                                                "0": { "name": "punctuation.section.block.end.bracket.curly.extern.cfa" }
     192                                        },
     193                                        "contentName": "meta.body.extern.cfa",
     194                                        "patterns": [{ "include": "$self" }]
     195                                }
     196                        }
     197                },
     198                "declaration": {
     199                        "patterns": [
     200                                {"include": "#declaration.type"},
     201                                {"include": "#declaration.aggregate"}
     202                        ],
     203                        "repository": {
     204                                "declaration.type": {
     205                                        "patterns": [
     206                                                        { "match": "\\b(void|bool|char|short|int|long|signed|unsigned|float|double)", "name": "storage.type.built-in.primitive.cfa"},
     207                                                        { "match": "\\b(zero_t|one_t|size_t|ssize_t|intptr_t|uintptr_t|\\$thread|\\$coroutine|\\$generator|\\$monitor)", "name": "storage.type.built-in.cfa"},
     208                                                        { "match": "\\b(extern|static|inline|volatile|const|thread_local)", "name": "storage.modifier.cfa"}
     209                                        ]
     210                                },
     211                                "declaration.aggregate": {
     212                                        "name": "meta.block.struct.cfa",
     213                                        "begin": "(struct|union|enum|trait|coroutine|generator|monitor|thread)\\s+(\\w+)\\s*(\\{)",
     214                                        "end": "(\\})(\\s+\\w+;)?",
     215                                        "beginCaptures": {
     216                                                "0": { "name": "meta.head.struct.cfa" },
     217                                                "1": { "name": "storage.type.struct.cfa"
     218                                                }
     219                                        },
     220                                        "endCaptures": {
     221                                                "1": { "name": "punctuation.section.block.end.bracket.curly.extern.cfa" }
     222                                        },
     223                                        "contentName": "meta.body.extern.cfa",
     224                                        "patterns": [{ "include": "#declaration" }]
     225                                }
     226                        }
     227                },
     228                "constant": {
     229                        "patterns": [
     230                                {"include": "#constant.pointer"},
     231                                {"include": "#constant.number"},
     232                                {"include": "#constant.string"}
     233                        ],
     234                        "repository": {
     235                                "constant.number": {
     236                                        "patterns":[
     237                                                {"name": "constant.numeric.binary.cfa", "match": "\\b0[b|B][_01\\.e]+(u?(hh|h|z|l\\d+|L\\d+|ll|l)u?)?"},
     238                                                {"name": "constant.numeric.hexadecimal.cfa", "match": "\\b0[x|X][_\\dabcdefABCDEF\\.p]+(u?(hh|h|z|l\\d+|L\\d+|ll|l)u?)?"},
     239                                                {"name": "constant.numeric.octal.cfa", "match": "\\b0[_0-7\\.]+(u?(hh|h|z|l\\d+|L\\d+|ll|l)u?)?"},
     240                                                {"name": "constant.numeric.decimal.cfa", "match": "\\b[\\d\\.][_\\d\\.e\\+]*(u?(hh|h|z|l\\d+|L\\d+|ll|l)u?)?"}
     241                                        ]
     242                                },
     243                                "constant.pointer": {
     244                                        "patterns":[
     245                                                {"name": "constant.language.binary.cfa", "match": "\\b0[b|B][_01]+p"},
     246                                                {"name": "constant.language.hexadecimal.cfa", "match": "\\b0[x|X][_\\dabcdefABCDEF]+p"},
     247                                                {"name": "constant.language.octal.cfa", "match": "\\b0[_0-7]+p"},
     248                                                {"name": "constant.language.decimal.cfa", "match": "\\b[\\d][_\\d\\.e\\+]*p"}
     249                                        ]
     250                                }
     251                        }
     252                },
     253                "operators": {
     254                        "patterns":[
     255                                {
     256                                        "name": "keyword.operator.declaration.cfa",
     257                                        "match": "\\?\\[\\?\\]|\\^\\?{}|\\?{}|\\?\\(\\)|\\?\\+\\+|\\?--|\\+\\+\\?|--\\?|\\*\\?|\\+\\?|\\-\\?|\\~\\?|\\!\\?|\\?\\\\=\\?|\\?\\\\\\?|\\?\\*=\\?|\\?\\*\\?|\\?/=\\?|\\?/\\?|\\?%=\\?|\\?%\\?|\\?\\+=\\?|\\?\\+\\?|\\?-=\\?|\\?-\\?|\\?<<=\\?|\\?<<\\?|\\?<=\\?|\\?<\\?|\\?>>=\\?|\\?>>\\?|\\?>=\\?|\\?>\\?|\\?==\\?|\\?\\!=\\?|\\?&=\\?|\\?&\\?|\\?\\^=\\?|\\?\\^\\?|\\?\\|=\\?|\\?\\|\\?|\\?=\\?"
     258                                },
     259                                {
     260                                        "name": "keyword.operator.cfa",
     261                                        "match": "\\?|\\+\\+|--|\\~|\\!|\\=|\\\\|\\*=|\\*|/=|/|%=|%|\\+=|\\+|-=|-|<<=|<<|<=|<|>>=|>>|>=|>|==|\\!=|&=|&|\\^=|\\^|\\|=|\\||="
     262                                }
    153263                        ]
    154                 },
    155                 "extern.head.string": {
    156                         "begin": "\"",
    157                         "end": "\"",
    158                         "beginCaptures": {
    159                                 "0": { "name": "punctuation.definition.string.begin.cfa" }
    160                         },
    161                         "endCaptures": {
    162                                 "0": { "name": "punctuation.definition.string.end.cfa" }
    163                         },
    164                         "name": "string.quoted.extern.cfa"
    165                 },
    166                 "extern.head": {
    167                         "match": "(extern)\\s+(.*)\\s+(\\{)",
    168                         "captures": {
    169                                 "1": { "name": "storage.modifier.cfa" },
    170                                 "2": { "patterns":[{ "include": "#extern.head.string"}] },
    171                                 "3": { "name": "punctuation.section.block.begin.bracket.curly.extern.cfa" }
    172                         }
    173                 },
    174                 "extern": {
    175                         "name": "meta.block.extern.cfa",
    176                         "begin": "(extern\\s+.*\\s+\\{)",
    177                         "end": "(\\})",
    178                         "beginCaptures": {
    179                                 "0": { "name": "meta.head.extern.cfa", "patterns":[{ "include": "#extern.head" }] }
    180                         },
    181                         "endCaptures": {
    182                                 "0": { "name": "punctuation.section.block.end.bracket.curly.extern.cfa" }
    183                         },
    184                         "contentName": "meta.body.extern.cfa",
    185                         "patterns": [{ "include": "$self" }]
    186264                }
    187265        }
Note: See TracChangeset for help on using the changeset viewer.