Start adding syntax highlighting
This commit is contained in:
		
							parent
							
								
									314f44304a
								
							
						
					
					
						commit
						0ba25db4c8
					
				| @ -1,12 +1,13 @@ | ||||
| // Main | ||||
| fn main() -> bool { | ||||
|     return 144 == fibonacci(0xc); | ||||
| } | ||||
| 
 | ||||
| // Fibonacci | ||||
| fn fibonacci(value: u16) -> u16 { | ||||
|     if value <= 2 { | ||||
|         return 1; | ||||
|     } | ||||
|     fibonacci(value - 1) + fibonacci(value - 2) | ||||
| } | ||||
| a | ||||
| ( | ||||
|     b | ||||
| ) | ||||
| x | ||||
| ( | ||||
|     ( | ||||
|         c | ||||
|         xyz | ||||
|     ) | ||||
| ) | ||||
| ( | ||||
| a | ||||
|  | ||||
| @ -43,11 +43,18 @@ | ||||
|           "description": "Traces the communication between VS Code and the language server." | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|     }, | ||||
|     "grammars": [ | ||||
|       { | ||||
|         "language": "reid", | ||||
|         "scopeName": "source.reid", | ||||
|         "path": "./syntaxes/grammar.json" | ||||
|       } | ||||
|     ] | ||||
|   }, | ||||
|   "scripts": { | ||||
|     "vscode:prepublish": "pnpm run package", | ||||
|     "compile": "webpack", | ||||
|     "compile": "npx js-yaml syntaxes/grammar.yaml > syntaxes/grammar.json && webpack", | ||||
|     "watch": "webpack --watch", | ||||
|     "package": "webpack --mode production --devtool hidden-source-map", | ||||
|     "compile-tests": "tsc -p . --outDir out", | ||||
| @ -65,6 +72,7 @@ | ||||
|     "@vscode/test-cli": "^0.0.11", | ||||
|     "@vscode/test-electron": "^2.5.2", | ||||
|     "eslint": "^9.25.1", | ||||
|     "js-yaml": "^4.1.0", | ||||
|     "ts-loader": "^9.5.2", | ||||
|     "typescript": "^5.8.3", | ||||
|     "webpack": "^5.99.7", | ||||
|  | ||||
							
								
								
									
										44
									
								
								reid-lsp/syntaxes/grammar.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										44
									
								
								reid-lsp/syntaxes/grammar.json
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,44 @@ | ||||
| { | ||||
|   "scopeName": "source.reid", | ||||
|   "patterns": [ | ||||
|     { | ||||
|       "include": "#expression" | ||||
|     } | ||||
|   ], | ||||
|   "repository": { | ||||
|     "expression": { | ||||
|       "patterns": [ | ||||
|         { | ||||
|           "include": "#letter" | ||||
|         }, | ||||
|         { | ||||
|           "include": "#paren-expression" | ||||
|         } | ||||
|       ] | ||||
|     }, | ||||
|     "letter": { | ||||
|       "match": "a|b|c", | ||||
|       "name": "keyword.letter" | ||||
|     }, | ||||
|     "paren-expression": { | ||||
|       "begin": "\\(", | ||||
|       "end": "\\)", | ||||
|       "beginCaptures": { | ||||
|         "0": { | ||||
|           "name": "punctuation.paren.open" | ||||
|         } | ||||
|       }, | ||||
|       "endCaptures": { | ||||
|         "0": { | ||||
|           "name": "punctuation.paren.close" | ||||
|         } | ||||
|       }, | ||||
|       "name": "expression.group", | ||||
|       "patterns": [ | ||||
|         { | ||||
|           "include": "#expression" | ||||
|         } | ||||
|       ] | ||||
|     } | ||||
|   } | ||||
| } | ||||
							
								
								
									
										23
									
								
								reid-lsp/syntaxes/grammar.yaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								reid-lsp/syntaxes/grammar.yaml
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,23 @@ | ||||
| scopeName: source.reid | ||||
| patterns: | ||||
|   - include: "#expression" | ||||
| repository: | ||||
|   expression: | ||||
|     patterns: | ||||
|       - include: "#letter" | ||||
|       - include: "#paren-expression" | ||||
|   letter: | ||||
|     match: "a|b|c" | ||||
|     name: "keyword.letter" | ||||
|   paren-expression: | ||||
|     begin: "\\(" | ||||
|     end: "\\)" | ||||
|     beginCaptures: | ||||
|       0: | ||||
|         name: "punctuation.paren.open" | ||||
|     endCaptures: | ||||
|       0: | ||||
|         name: "punctuation.paren.close" | ||||
|     name: "expression.group" | ||||
|     patterns: | ||||
|       - include: "#expression" | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user