Преглед на файлове

Pascal/Oberon TextMate grammars for syntax highlighting

Eric Streit преди 2 дни
родител
ревизия
c1f3db08a1

+ 92 - 0
extensions/oberon-language/syntaxes/oberon.tmLanguage.json

@@ -0,0 +1,92 @@
+{
+  "name": "Oberon",
+  "scopeName": "source.oberon",
+  "patterns": [
+    {
+      "include": "#comments"
+    },
+    {
+      "include": "#strings"
+    },
+    {
+      "include": "#numbers"
+    },
+    {
+      "include": "#keywords"
+    },
+    {
+      "include": "#types"
+    },
+    {
+      "include": "#operators"
+    }
+  ],
+  "repository": {
+    "comments": {
+      "patterns": [
+        {
+          "name": "comment.block.oberon",
+          "begin": "\\(\\*",
+          "end": "\\*\\)",
+          "patterns": [
+            {
+              "include": "#comments"
+            }
+          ]
+        }
+      ]
+    },
+    "strings": {
+      "patterns": [
+        {
+          "name": "string.quoted.double.oberon",
+          "begin": "\"",
+          "end": "\""
+        },
+        {
+          "name": "string.quoted.single.oberon",
+          "begin": "'",
+          "end": "'",
+          "patterns": [
+            {
+              "name": "constant.character.escape.oberon",
+              "match": "''"
+            }
+          ]
+        }
+      ]
+    },
+    "numbers": {
+      "patterns": [
+        {
+          "name": "constant.numeric.oberon",
+          "match": "\\b(?:[0-9A-Fa-f]+H|[0-9A-Fa-f]+X|\\d+\\.\\d+(?:[ED][+-]?\\d+)?|\\d+)(?!\\w)"
+        }
+      ]
+    },
+    "keywords": {
+      "patterns": [
+        {
+          "name": "keyword.control.oberon",
+          "match": "(?i)\\b(?:AND|ARRAY|BEGIN|BY|CASE|CONST|DEFINITION|DIV|DO|ELSE|ELSIF|END|EXIT|FOR|IF|IMPORT|IN|IS|LOOP|MOD|MODULE|NIL|NOT|OF|OR|POINTER|PROCEDURE|RECORD|REPEAT|RETURN|THEN|TO|TYPE|UNTIL|VAR|WHILE|WITH)\\b"
+        }
+      ]
+    },
+    "types": {
+      "patterns": [
+        {
+          "name": "storage.type.oberon",
+          "match": "(?i)\\b(?:INTEGER|SHORTINT|LONGINT|REAL|LONGREAL|CHAR|BOOLEAN|SET)\\b"
+        }
+      ]
+    },
+    "operators": {
+      "patterns": [
+        {
+          "name": "keyword.operator.oberon",
+          "match": ":=|<=|>=|<>|=|<|>|#|\\+|-|\\*|/|\\.\\.|&|~|\\^"
+        }
+      ]
+    }
+  }
+}

+ 10 - 0
extensions/oberon-project/tsconfig.json

@@ -0,0 +1,10 @@
+{
+  "compilerOptions": {
+    "target": "ES2022", "module": "commonjs", "lib": ["ES2022"],
+    "outDir": "lib", "rootDir": "src", "strict": true,
+    "experimentalDecorators": true, "emitDecoratorMetadata": true,
+    "strictPropertyInitialization": false,
+    "sourceMap": true, "esModuleInterop": true, "skipLibCheck": true
+  },
+  "include": ["src/**/*.ts"]
+}

+ 87 - 0
extensions/pascal-language/syntaxes/pascal.tmLanguage.json

@@ -0,0 +1,87 @@
+{
+  "name": "Pascal",
+  "scopeName": "source.pascal",
+  "patterns": [
+    {
+      "include": "#comments"
+    },
+    {
+      "include": "#strings"
+    },
+    {
+      "include": "#numbers"
+    },
+    {
+      "include": "#keywords"
+    },
+    {
+      "include": "#types"
+    },
+    {
+      "include": "#operators"
+    }
+  ],
+  "repository": {
+    "comments": {
+      "patterns": [
+        {
+          "name": "comment.block.pascal",
+          "begin": "\\(\\*",
+          "end": "\\*\\)"
+        },
+        {
+          "name": "comment.block.pascal",
+          "begin": "\\{",
+          "end": "\\}"
+        }
+      ]
+    },
+    "strings": {
+      "patterns": [
+        {
+          "name": "string.quoted.single.pascal",
+          "begin": "'",
+          "end": "'",
+          "patterns": [
+            {
+              "name": "constant.character.escape.pascal",
+              "match": "''"
+            }
+          ]
+        }
+      ]
+    },
+    "numbers": {
+      "patterns": [
+        {
+          "name": "constant.numeric.pascal",
+          "match": "(?<!\\w)(?:\\$[0-9A-Fa-f]+|&[0-7]+|%[01]+|\\d+\\.\\d+(?:[Ee][+-]?\\d+)?|\\d+)(?!\\w)"
+        }
+      ]
+    },
+    "keywords": {
+      "patterns": [
+        {
+          "name": "keyword.control.pascal",
+          "match": "(?i)\\b(?:AND|ARRAY|BEGIN|CASE|CONST|DIV|DO|DOWNTO|ELSE|END|FILE|FOR|FORWARD|FUNCTION|GOTO|IF|IN|LABEL|MOD|NIL|NOT|OF|OR|PACKED|PROCEDURE|PROGRAM|RECORD|REPEAT|SET|THEN|TO|TYPE|UNIT|UNTIL|USES|VAR|WHILE|WITH)\\b"
+        }
+      ]
+    },
+    "types": {
+      "patterns": [
+        {
+          "name": "storage.type.pascal",
+          "match": "(?i)\\b(?:INTEGER|SHORTINT|LONGINT|CARDINAL|REAL|CHAR|BOOLEAN|STRING|TEXT)\\b"
+        }
+      ]
+    },
+    "operators": {
+      "patterns": [
+        {
+          "name": "keyword.operator.pascal",
+          "match": ":=|<=|>=|<>|=|<|>|\\+|-|\\*|/|\\.\\.|@|\\^"
+        }
+      ]
+    }
+  }
+}

+ 10 - 0
extensions/pascal-project/tsconfig.json

@@ -0,0 +1,10 @@
+{
+  "compilerOptions": {
+    "target": "ES2022", "module": "commonjs", "lib": ["ES2022"],
+    "outDir": "lib", "rootDir": "src", "strict": true,
+    "experimentalDecorators": true, "emitDecoratorMetadata": true,
+    "strictPropertyInitialization": false,
+    "sourceMap": true, "esModuleInterop": true, "skipLibCheck": true
+  },
+  "include": ["src/**/*.ts"]
+}