App-Mxpress-PDF
view release on metacpan or search on metacpan
public/javascripts/ace/mode-csound_orchestra.js view on Meta::CPAN
var oop = require("../lib/oop");
var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
var CsoundPreprocessorHighlightRules = function(embeddedRulePrefix) {
this.embeddedRulePrefix = embeddedRulePrefix === undefined ? "" : embeddedRulePrefix;
this.semicolonComments = {
token : "comment.line.semicolon.csound",
regex : ";.*$"
};
this.comments = [
{
token : "punctuation.definition.comment.begin.csound",
regex : "/\\*",
push : [
{
token : "punctuation.definition.comment.end.csound",
regex : "\\*/",
next : "pop"
}, {
defaultToken: "comment.block.csound"
}
]
}, {
token : "comment.line.double-slash.csound",
regex : "//.*$"
},
this.semicolonComments
];
this.macroUses = [
{
token : ["entity.name.function.preprocessor.csound", "punctuation.definition.macro-parameter-value-list.begin.csound"],
regex : /(\$[A-Z_a-z]\w*\.?)(\()/,
next : "macro parameter value list"
}, {
token : "entity.name.function.preprocessor.csound",
regex : /\$[A-Z_a-z]\w*(?:\.|\b)/
}
];
this.numbers = [
{
token : "constant.numeric.float.csound",
regex : /(?:\d+[Ee][+-]?\d+)|(?:\d+\.\d*|\d*\.\d+)(?:[Ee][+-]?\d+)?/
}, {
token : ["storage.type.number.csound", "constant.numeric.integer.hexadecimal.csound"],
regex : /(0[Xx])([0-9A-Fa-f]+)/
}, {
token : "constant.numeric.integer.decimal.csound",
regex : /\d+/
}
];
this.bracedStringContents = [
{
token : "constant.character.escape.csound",
regex : /\\(?:[\\abnrt"]|[0-7]{1,3})/
},
{
token : "constant.character.placeholder.csound",
regex : /%[#0\- +]*\d*(?:\.\d+)?[diuoxXfFeEgGaAcs]/
}, {
token : "constant.character.escape.csound",
regex : /%%/
}
];
this.quotedStringContents = [
this.macroUses,
this.bracedStringContents
];
var start = [
this.comments,
{
token : "keyword.preprocessor.csound",
regex : /#(?:e(?:nd(?:if)?|lse)\b|##)|@@?[ \t]*\d+/
}, {
token : "keyword.preprocessor.csound",
regex : /#include/,
push : [
this.comments,
{
token : "string.csound",
regex : /([^ \t])(?:.*?\1)/,
next : "pop"
}
]
}, {
token : "keyword.preprocessor.csound",
regex : /#includestr/,
push : [
this.comments,
{
token : "string.csound",
regex : /([^ \t])(?:.*?\1)/,
next : "pop"
}
]
}, {
token : "keyword.preprocessor.csound",
regex : /#[ \t]*define/,
next : "define directive"
}, {
token : "keyword.preprocessor.csound",
regex : /#(?:ifn?def|undef)\b/,
next : "macro directive"
},
this.macroUses
];
this.$rules = {
"start": start,
"define directive": [
this.comments,
{
token : "entity.name.function.preprocessor.csound",
regex : /[A-Z_a-z]\w*/
}, {
token : "punctuation.definition.macro-parameter-name-list.begin.csound",
regex : /\(/,
next : "macro parameter name list"
}, {
token : "punctuation.definition.macro.begin.csound",
regex : /#/,
next : "macro body"
}
],
"macro parameter name list": [
{
token : "variable.parameter.preprocessor.csound",
regex : /[A-Z_a-z]\w*/
}, {
token : "punctuation.definition.macro-parameter-name-list.end.csound",
regex : /\)/,
next : "define directive"
}
],
"macro body": [
{
token : "constant.character.escape.csound",
regex : /\\#/
}, {
token : "punctuation.definition.macro.end.csound",
regex : /#/,
next : "start"
},
start
],
"macro directive": [
this.comments,
{
token : "entity.name.function.preprocessor.csound",
regex : /[A-Z_a-z]\w*/,
next : "start"
}
],
"macro parameter value list": [
{
token : "punctuation.definition.macro-parameter-value-list.end.csound",
regex : /\)/,
next : "start"
}, {
token : "punctuation.definition.string.begin.csound",
regex : /"/,
next : "macro parameter value quoted string"
}, this.pushRule({
token : "punctuation.macro-parameter-value-parenthetical.begin.csound",
regex : /\(/,
next : "macro parameter value parenthetical"
}), {
token : "punctuation.macro-parameter-value-separator.csound",
regex : "[#']"
}
],
"macro parameter value quoted string": [
{
token : "constant.character.escape.csound",
regex : /\\[#'()]/
}, {
token : "invalid.illegal.csound",
regex : /[#'()]/
}, {
token : "punctuation.definition.string.end.csound",
regex : /"/,
next : "macro parameter value list"
},
this.quotedStringContents,
{
defaultToken: "string.quoted.csound"
}
],
"macro parameter value parenthetical": [
{
token : "constant.character.escape.csound",
regex : /\\\)/
}, this.popRule({
token : "punctuation.macro-parameter-value-parenthetical.end.csound",
regex : /\)/
}), this.pushRule({
token : "punctuation.macro-parameter-value-parenthetical.begin.csound",
regex : /\(/,
next : "macro parameter value parenthetical"
}),
start
]
};
};
oop.inherits(CsoundPreprocessorHighlightRules, TextHighlightRules);
(function() {
this.pushRule = function(params) {
if (Array.isArray(params.next)) {
for (var i = 0; i < params.next.length; i++) {
params.next[i] = this.embeddedRulePrefix + params.next[i];
}
}
return {
regex : params.regex, onMatch: function(value, currentState, stack, line) {
if (stack.length === 0)
stack.push(currentState);
if (Array.isArray(params.next)) {
for (var i = 0; i < params.next.length; i++) {
stack.push(params.next[i]);
}
} else {
stack.push(params.next);
}
this.next = stack[stack.length - 1];
return params.token;
},
get next() { return Array.isArray(params.next) ? params.next[params.next.length - 1] : params.next; },
set next(next) {
if (!Array.isArray(params.next)) {
params.next = next;
}
},
get token() { return params.token; }
};
};
this.popRule = function(params) {
if (params.next) {
params.next = this.embeddedRulePrefix + params.next;
}
return {
regex : params.regex, onMatch: function(value, currentState, stack, line) {
stack.pop();
if (params.next) {
public/javascripts/ace/mode-csound_orchestra.js view on Meta::CPAN
next: "rawqqstring"
}, {
token: "string",
regex: strRawPre + "'{3}",
next: "rawqstring3"
}, {
token: "string",
regex: strRawPre + "'(?=.)",
next: "rawqstring"
}, {
token: "string",
regex: strFormatPre + '"{3}',
next: "fqqstring3"
}, {
token: "string",
regex: strFormatPre + '"(?=.)',
next: "fqqstring"
}, {
token: "string",
regex: strFormatPre + "'{3}",
next: "fqstring3"
}, {
token: "string",
regex: strFormatPre + "'(?=.)",
next: "fqstring"
},{
token: "string",
regex: strRawFormatPre + '"{3}',
next: "rfqqstring3"
}, {
token: "string",
regex: strRawFormatPre + '"(?=.)',
next: "rfqqstring"
}, {
token: "string",
regex: strRawFormatPre + "'{3}",
next: "rfqstring3"
}, {
token: "string",
regex: strRawFormatPre + "'(?=.)",
next: "rfqstring"
}, {
token: "keyword.operator",
regex: "\\+|\\-|\\*|\\*\\*|\\/|\\/\\/|%|@|<<|>>|&|\\||\\^|~|<|>|<=|=>|==|!=|<>|="
}, {
token: "punctuation",
regex: ",|:|;|\\->|\\+=|\\-=|\\*=|\\/=|\\/\\/=|%=|@=|&=|\\|=|^=|>>=|<<=|\\*\\*="
}, {
token: "paren.lparen",
regex: "[\\[\\(\\{]"
}, {
token: "paren.rparen",
regex: "[\\]\\)\\}]"
}, {
token: "text",
regex: "\\s+"
}, {
include: "constants"
}],
"qqstring3": [{
token: "constant.language.escape",
regex: stringEscape
}, {
token: "string", // multi line """ string end
regex: '"{3}',
next: "start"
}, {
defaultToken: "string"
}],
"qstring3": [{
token: "constant.language.escape",
regex: stringEscape
}, {
token: "string", // multi line ''' string end
regex: "'{3}",
next: "start"
}, {
defaultToken: "string"
}],
"qqstring": [{
token: "constant.language.escape",
regex: stringEscape
}, {
token: "string",
regex: "\\\\$",
next: "qqstring"
}, {
token: "string",
regex: '"|$',
next: "start"
}, {
defaultToken: "string"
}],
"qstring": [{
token: "constant.language.escape",
regex: stringEscape
}, {
token: "string",
regex: "\\\\$",
next: "qstring"
}, {
token: "string",
regex: "'|$",
next: "start"
}, {
defaultToken: "string"
}],
"rawqqstring3": [{
token: "string", // multi line """ string end
regex: '"{3}',
next: "start"
}, {
defaultToken: "string"
}],
"rawqstring3": [{
token: "string", // multi line ''' string end
regex: "'{3}",
next: "start"
}, {
defaultToken: "string"
}],
"rawqqstring": [{
token: "string",
regex: "\\\\$",
next: "rawqqstring"
}, {
token: "string",
regex: '"|$',
next: "start"
}, {
defaultToken: "string"
}],
"rawqstring": [{
token: "string",
regex: "\\\\$",
next: "rawqstring"
}, {
token: "string",
regex: "'|$",
next: "start"
}, {
defaultToken: "string"
}],
"fqqstring3": [{
token: "constant.language.escape",
regex: stringEscape
}, {
token: "string", // multi line """ string end
regex: '"{3}',
next: "start"
}, {
token: "paren.lparen",
regex: "{",
push: "fqstringParRules"
}, {
defaultToken: "string"
}],
"fqstring3": [{
token: "constant.language.escape",
regex: stringEscape
}, {
token: "string", // multi line ''' string end
regex: "'{3}",
next: "start"
}, {
token: "paren.lparen",
regex: "{",
push: "fqstringParRules"
}, {
defaultToken: "string"
}],
"fqqstring": [{
token: "constant.language.escape",
regex: stringEscape
}, {
token: "string",
regex: "\\\\$",
next: "fqqstring"
}, {
token: "string",
regex: '"|$',
next: "start"
}, {
token: "paren.lparen",
regex: "{",
push: "fqstringParRules"
}, {
defaultToken: "string"
}],
"fqstring": [{
token: "constant.language.escape",
regex: stringEscape
}, {
token: "string",
regex: "'|$",
next: "start"
}, {
token: "paren.lparen",
regex: "{",
push: "fqstringParRules"
}, {
defaultToken: "string"
}],
"rfqqstring3": [{
token: "string", // multi line """ string end
regex: '"{3}',
next: "start"
}, {
token: "paren.lparen",
regex: "{",
push: "fqstringParRules"
}, {
defaultToken: "string"
}],
"rfqstring3": [{
token: "string", // multi line ''' string end
regex: "'{3}",
next: "start"
}, {
token: "paren.lparen",
regex: "{",
push: "fqstringParRules"
}, {
defaultToken: "string"
}],
"rfqqstring": [{
token: "string",
regex: "\\\\$",
next: "rfqqstring"
}, {
token: "string",
regex: '"|$',
next: "start"
}, {
token: "paren.lparen",
regex: "{",
push: "fqstringParRules"
}, {
defaultToken: "string"
}],
"rfqstring": [{
token: "string",
regex: "'|$",
next: "start"
}, {
token: "paren.lparen",
regex: "{",
push: "fqstringParRules"
}, {
defaultToken: "string"
}],
public/javascripts/ace/mode-csound_orchestra.js view on Meta::CPAN
"specdiff",
"specdisp",
"specfilt",
"spechist",
"specptrk",
"specscal",
"specsum",
"spectrum",
"stack",
"sumtab",
"tabgen",
"tableiw",
"tabmap",
"tabmap_i",
"tabslice",
"tb0",
"tb0_init",
"tb1",
"tb10",
"tb10_init",
"tb11",
"tb11_init",
"tb12",
"tb12_init",
"tb13",
"tb13_init",
"tb14",
"tb14_init",
"tb15",
"tb15_init",
"tb1_init",
"tb2",
"tb2_init",
"tb3",
"tb3_init",
"tb4",
"tb4_init",
"tb5",
"tb5_init",
"tb6",
"tb6_init",
"tb7",
"tb7_init",
"tb8",
"tb8_init",
"tb9",
"tb9_init",
"vbap16",
"vbap4",
"vbap4move",
"vbap8",
"vbap8move",
"xyin"
];
opcodes = lang.arrayToMap(opcodes);
deprecatedOpcodes = lang.arrayToMap(deprecatedOpcodes);
this.lineContinuations = [
{
token : "constant.character.escape.line-continuation.csound",
regex : /\\$/
}, this.pushRule({
token : "constant.character.escape.line-continuation.csound",
regex : /\\/,
next : "line continuation"
})
];
this.comments.push(this.lineContinuations);
this.quotedStringContents.push(
this.lineContinuations,
{
token : "invalid.illegal",
regex : /[^"\\]*$/
}
);
var start = this.$rules.start;
start.splice(1, 0, {
token : ["text.csound", "entity.name.label.csound", "entity.punctuation.label.csound", "text.csound"],
regex : /^([ \t]*)(\w+)(:)([ \t]+|$)/
});
start.push(
this.pushRule({
token : "keyword.function.csound",
regex : /\binstr\b/,
next : "instrument numbers and identifiers"
}), this.pushRule({
token : "keyword.function.csound",
regex : /\bopcode\b/,
next : "after opcode keyword"
}), {
token : "keyword.other.csound",
regex : /\bend(?:in|op)\b/
},
{
token : "variable.language.csound",
regex : /\b(?:0dbfs|A4|k(?:r|smps)|nchnls(?:_i)?|sr)\b/
},
this.numbers,
{
token : "keyword.operator.csound",
regex : "\\+=|-=|\\*=|/=|<<|>>|<=|>=|==|!=|&&|\\|\\||[~¬]|[=!+\\-*/^%&|<>#?:]"
},
this.pushRule({
token : "punctuation.definition.string.begin.csound",
regex : /"/,
next : "quoted string"
}), this.pushRule({
token : "punctuation.definition.string.begin.csound",
regex : /{{/,
next : "braced string"
}),
{
token : "keyword.control.csound",
regex : /\b(?:do|else(?:if)?|end(?:if|until)|fi|i(?:f|then)|kthen|od|r(?:ir)?eturn|then|until|while)\b/
},
public/javascripts/ace/mode-csound_orchestra.js view on Meta::CPAN
regex : /\btimout\b/,
next : ["goto before label", "goto before argument", "goto before argument"]
}), this.pushRule({
token : "keyword.control.csound",
regex : /\bloop_[gl][et]\b/,
next : ["goto before label", "goto before argument", "goto before argument", "goto before argument"]
}),
this.pushRule({
token : "support.function.csound",
regex : /\b(?:readscore|scoreline(?:_i)?)\b/,
next : "Csound score opcode"
}), this.pushRule({
token : "support.function.csound",
regex : /\bpyl?run[it]?\b(?!$)/,
next : "Python opcode"
}), this.pushRule({
token : "support.function.csound",
regex : /\blua_(?:exec|opdef)\b(?!$)/,
next : "Lua opcode"
}),
{
token : "support.variable.csound",
regex : /\bp\d+\b/
}, {
regex : /\b([A-Z_a-z]\w*)(?:(:)([A-Za-z]))?\b/, onMatch: function(value, currentState, stack, line) {
var tokens = value.split(this.splitRegex);
var name = tokens[1];
var type;
if (opcodes.hasOwnProperty(name))
type = "support.function.csound";
else if (deprecatedOpcodes.hasOwnProperty(name))
type = "invalid.deprecated.csound";
if (type) {
if (tokens[2]) {
return [
{type: type, value: name},
{type: "punctuation.type-annotation.csound", value: tokens[2]},
{type: "type-annotation.storage.type.csound", value: tokens[3]}
];
}
return type;
}
return "text.csound";
}
}
);
this.$rules["macro parameter value list"].splice(2, 0, {
token : "punctuation.definition.string.begin.csound",
regex : /{{/,
next : "macro parameter value braced string"
});
var scoreHighlightRules = new CsoundScoreHighlightRules("csound-score-");
this.addRules({
"macro parameter value braced string": [
{
token : "constant.character.escape.csound",
regex : /\\[#'()]/
}, {
token : "invalid.illegal.csound.csound",
regex : /[#'()]/
}, {
token : "punctuation.definition.string.end.csound",
regex : /}}/,
next : "macro parameter value list"
}, {
defaultToken: "string.braced.csound"
}
],
"instrument numbers and identifiers": [
this.comments,
{
token : "entity.name.function.csound",
regex : /\d+|[A-Z_a-z]\w*/
}, this.popRule({
token : "empty",
regex : /$/
})
],
"after opcode keyword": [
this.comments,
this.popRule({
token : "empty",
regex : /$/
}), this.popRule({
token : "entity.name.function.opcode.csound",
regex : /[A-Z_a-z]\w*/,
next : "opcode type signatures"
})
],
"opcode type signatures": [
this.comments,
this.popRule({
token : "empty",
regex : /$/
}), {
token : "storage.type.csound",
regex : /\b(?:0|[afijkKoOpPStV\[\]]+)/
}
],
"quoted string": [
this.popRule({
token : "punctuation.definition.string.end.csound",
regex : /"/
}),
this.quotedStringContents,
{
defaultToken: "string.quoted.csound"
}
],
"braced string": [
this.popRule({
token : "punctuation.definition.string.end.csound",
regex : /}}/
( run in 0.995 second using v1.01-cache-2.11-cpan-39bf76dae61 )