| 25 | import * as monaco from 'monaco-editor'; |
| 26 | |
| 27 | function definition(): monaco.languages.IMonarchLanguage { |
| 28 | return { |
| 29 | tokenizer: { |
| 30 | root: [ |
| 31 | [/^(\| )*==.*$/, 'comment'], |
| 32 | [/^(\| )*catch type.*$/, 'comment'], |
| 33 | [/^(\| )*local table.*$/, 'comment'], |
| 34 | [/^(\| )*\[\s*\d+\].*$/, 'comment'], |
| 35 | [/^(\| )*\|-+$/, 'comment'], |
| 36 | [/^((?:\| )*)(\d+)/, ['comment', 'number'], '@opcode'], |
| 37 | [/^((?:\| )*)(\d+)(\s+)/, ['comment', 'number'], '@opcode'], |
| 38 | ], |
| 39 | |
| 40 | opcode: [ |
| 41 | [/[a-z_]\w*\s*$/, {token: 'keyword', next: '@root'}], |
| 42 | [/([a-z_]\w*)(\s+)/, 'keyword', '@arguments'], |
| 43 | ], |
| 44 | |
| 45 | arguments: [ |
| 46 | [/(.*?)(\(\s*\d+\)(?:\[[^\]]+\])?)$/, {token: 'comment', next: '@root'}], |
| 47 | [/.*$/, {token: '', next: '@root'}], |
| 48 | ], |
| 49 | }, |
| 50 | }; |
| 51 | } |
| 52 | |
| 53 | const def = definition(); |
| 54 | monaco.languages.register({id: 'asmruby'}); |