[d24f17c] | 1 | 'use strict'
|
---|
| 2 |
|
---|
| 3 | module.exports = gdscript
|
---|
| 4 | gdscript.displayName = 'gdscript'
|
---|
| 5 | gdscript.aliases = []
|
---|
| 6 | function gdscript(Prism) {
|
---|
| 7 | Prism.languages.gdscript = {
|
---|
| 8 | comment: /#.*/,
|
---|
| 9 | string: {
|
---|
| 10 | pattern:
|
---|
| 11 | /@?(?:("|')(?:(?!\1)[^\n\\]|\\[\s\S])*\1(?!"|')|"""(?:[^\\]|\\[\s\S])*?""")/,
|
---|
| 12 | greedy: true
|
---|
| 13 | },
|
---|
| 14 | 'class-name': {
|
---|
| 15 | // class_name Foo, extends Bar, class InnerClass
|
---|
| 16 | // export(int) var baz, export(int, 0) var i
|
---|
| 17 | // as Node
|
---|
| 18 | // const FOO: int = 9, var bar: bool = true
|
---|
| 19 | // func add(reference: Item, amount: int) -> Item:
|
---|
| 20 | pattern:
|
---|
| 21 | /(^(?:class|class_name|extends)[ \t]+|^export\([ \t]*|\bas[ \t]+|(?:\b(?:const|var)[ \t]|[,(])[ \t]*\w+[ \t]*:[ \t]*|->[ \t]*)[a-zA-Z_]\w*/m,
|
---|
| 22 | lookbehind: true
|
---|
| 23 | },
|
---|
| 24 | keyword:
|
---|
| 25 | /\b(?:and|as|assert|break|breakpoint|class|class_name|const|continue|elif|else|enum|export|extends|for|func|if|in|is|master|mastersync|match|not|null|onready|or|pass|preload|puppet|puppetsync|remote|remotesync|return|self|setget|signal|static|tool|var|while|yield)\b/,
|
---|
| 26 | function: /\b[a-z_]\w*(?=[ \t]*\()/i,
|
---|
| 27 | variable: /\$\w+/,
|
---|
| 28 | number: [
|
---|
| 29 | /\b0b[01_]+\b|\b0x[\da-fA-F_]+\b|(?:\b\d[\d_]*(?:\.[\d_]*)?|\B\.[\d_]+)(?:e[+-]?[\d_]+)?\b/,
|
---|
| 30 | /\b(?:INF|NAN|PI|TAU)\b/
|
---|
| 31 | ],
|
---|
| 32 | constant: /\b[A-Z][A-Z_\d]*\b/,
|
---|
| 33 | boolean: /\b(?:false|true)\b/,
|
---|
| 34 | operator: /->|:=|&&|\|\||<<|>>|[-+*/%&|!<>=]=?|[~^]/,
|
---|
| 35 | punctuation: /[.:,;()[\]{}]/
|
---|
| 36 | }
|
---|
| 37 | }
|
---|