|
Added
Link Here
|
| 1 |
/******************************************************************************* |
| 2 |
* @license |
| 3 |
* Copyright (c) 2014 IBM Corporation and others. |
| 4 |
* All rights reserved. This program and the accompanying materials are made |
| 5 |
* available under the terms of the Eclipse Public License v1.0 |
| 6 |
* (http://www.eclipse.org/legal/epl-v10.html), and the Eclipse Distribution |
| 7 |
* License v1.0 (http://www.eclipse.org/org/documents/edl-v10.html). |
| 8 |
* |
| 9 |
* Contributors: IBM Corporation - initial API and implementation |
| 10 |
******************************************************************************/ |
| 11 |
|
| 12 |
/*global define*/ |
| 13 |
|
| 14 |
define("orion/editor/stylers/text_x-erlang/syntax", ["orion/editor/stylers/lib/syntax"], function(mLib) { //$NON-NLS-1$ //$NON-NLS-0$ |
| 15 |
var keywords = [ |
| 16 |
"fun", |
| 17 |
"when", |
| 18 |
"end", |
| 19 |
"receive", |
| 20 |
"case", |
| 21 |
"of", |
| 22 |
"if", |
| 23 |
"after", |
| 24 |
"catch", |
| 25 |
"try", |
| 26 |
"begin", |
| 27 |
"orelse", |
| 28 |
"andalso" |
| 29 |
|
| 30 |
]; |
| 31 |
|
| 32 |
// For Preprocessors, Records and so on specified with hyphens |
| 33 |
var hyphenStuff = [ |
| 34 |
"module", |
| 35 |
"export", |
| 36 |
"import", |
| 37 |
"compile", |
| 38 |
"vsn", |
| 39 |
"on_load", |
| 40 |
"spec", |
| 41 |
"record", |
| 42 |
"include", |
| 43 |
"include_lib", |
| 44 |
"define", |
| 45 |
"file", |
| 46 |
"type", |
| 47 |
"opaque", |
| 48 |
"export_type", |
| 49 |
"undef", |
| 50 |
"ifdef", |
| 51 |
"ifndef", |
| 52 |
"else", |
| 53 |
"endif" |
| 54 |
]; |
| 55 |
|
| 56 |
var signs = [ |
| 57 |
"#", |
| 58 |
":", |
| 59 |
"::" |
| 60 |
]; |
| 61 |
|
| 62 |
var grammars = mLib.grammars; |
| 63 |
grammars.push({ |
| 64 |
id: "orion.erlang", //$NON-NLS-0$ |
| 65 |
contentTypes: ["text/x-erlang"], //$NON-NLS-0$ // Connection to erlangPlugin.js |
| 66 |
patterns: [ |
| 67 |
{include: "#comment"}, |
| 68 |
{include: "#arrow"}, |
| 69 |
{include: "orion.xq#variable"}, |
| 70 |
{include: "orion.lib#string_doubleQuote"}, //$NON-NLS-0$ |
| 71 |
{include: "orion.lib#string_singleQuote"}, //$NON-NLS-0$ |
| 72 |
{include: "orion.lib#doc_block"}, //$NON-NLS-0$ |
| 73 |
{include: "orion.lib#brace_open"}, //$NON-NLS-0$ |
| 74 |
{include: "orion.lib#brace_close"}, //$NON-NLS-0$ |
| 75 |
{include: "orion.lib#bracket_open"}, //$NON-NLS-0$ |
| 76 |
{include: "orion.lib#bracket_close"}, //$NON-NLS-0$ |
| 77 |
{include: "orion.lib#parenthesis_open"}, //$NON-NLS-0$ |
| 78 |
{include: "orion.lib#parenthesis_close"}, //$NON-NLS-0$ |
| 79 |
{include: "orion.lib#number_decimal"}, //$NON-NLS-0$ |
| 80 |
{include: "orion.lib#number_hex"}, //$NON-NLS-0$ |
| 81 |
{ |
| 82 |
match: "\\b(?:" + keywords.join("|") + ")\\b", //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$ |
| 83 |
name: "keyword.control.erlang" //$NON-NLS-0$ |
| 84 |
}, |
| 85 |
{ |
| 86 |
match: "-\\b(?:" + hyphenStuff.join("|") + ")\\b", //$NON-NLS-2$ //$NON-NLS-1$ //$NON-NLS-0$ |
| 87 |
name: "keyword.control.erlang" //$NON-NLS-0$ |
| 88 |
}, |
| 89 |
{ |
| 90 |
match: signs.join("|"), |
| 91 |
name: "sign.erl" |
| 92 |
} |
| 93 |
], |
| 94 |
repository: { |
| 95 |
comment: { |
| 96 |
match: {match: "%.*", literal: "%"}, //$NON-NLS-1$ //$NON-NLS-0$ |
| 97 |
name: "comment.line.erlang", //$NON-NLS-0$ |
| 98 |
patterns: [ |
| 99 |
{ |
| 100 |
include: "orion.lib#todo_comment_singleLine" //$NON-NLS-0$ |
| 101 |
} |
| 102 |
] |
| 103 |
}, |
| 104 |
arrow: { |
| 105 |
match: "->|=>", //$NON-NLS-0$ |
| 106 |
name: "arrow.erl" //$NON-NLS-0$ |
| 107 |
}, |
| 108 |
method: { |
| 109 |
match: "[a-zA-Z0-9_.]+(?=\\(|\\s\\()", |
| 110 |
name: "method.erl" |
| 111 |
} |
| 112 |
} |
| 113 |
|
| 114 |
}); |
| 115 |
return { |
| 116 |
id: grammars[grammars.length - 1].id, |
| 117 |
grammars: grammars, |
| 118 |
keywords: keywords |
| 119 |
}; |
| 120 |
}); |