-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
263 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
Prism.languages.n4js = Prism.languages.extend('javascript', { | ||
// Keywords from N4JS language spec: https://numberfour.github.io/n4js/spec/N4JSSpec.html | ||
'keyword': /\b(any|Array|boolean|break|case|catch|class|const|constructor|continue|debugger|declare|default|delete|do|else|enum|export|extends|false|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|module|new|null|number|package|private|protected|public|return|set|static|string|super|switch|this|throw|true|try|typeof|var|void|while|with|yield)\b/ | ||
}); | ||
|
||
Prism.languages.insertBefore('n4js', 'function', { | ||
// Annotations in N4JS spec: https://numberfour.github.io/n4js/spec/N4JSSpec.html#_annotations | ||
'annotation': { | ||
pattern: /(@+\w+)/, | ||
alias: 'operator' | ||
} | ||
}); | ||
|
||
Prism.languages.n4jsd=Prism.languages.n4js; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<h1>N4JS</h1> | ||
<p>To use this language, use the class "language-n4js".</p> | ||
|
||
<h2>Full example</h2> | ||
<pre><code>//Creating a simple Web User Interface in HTML | ||
|
||
import { TaskManager } from "TaskManager" | ||
import {Application, Response } from "express"; | ||
import express from "express"; | ||
import { Todo } from "model" | ||
|
||
export class WebUI { | ||
|
||
private app: Application; | ||
|
||
@Inject | ||
private manager: TaskManager; | ||
|
||
public start() { | ||
|
||
this.app = express(); | ||
|
||
this.app.get('/', async (req, res) => { | ||
let page = await this.renderHomePage(); | ||
res.send(page); | ||
}); | ||
} | ||
} | ||
</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
@Inject | ||
@Internal | ||
@Undefined | ||
@StringBased | ||
@Final | ||
@GenerateInjector | ||
@WithParentInjector | ||
@Spec | ||
@Override | ||
@Promisifiable | ||
@Promisify | ||
@This | ||
@N4JS | ||
@IgnoreImplementation | ||
@Global | ||
@ProvidedByRuntime | ||
@TestAPI | ||
@Polyfill | ||
@StaticPolyfill | ||
@StaticPolyfillAware | ||
@StaticPolyfillModule | ||
@Transient | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["annotation", "@Inject"], | ||
["annotation", "@Internal"], | ||
["annotation", "@Undefined"], | ||
["annotation", "@StringBased"], | ||
["annotation", "@Final"], | ||
["annotation", "@GenerateInjector"], | ||
["annotation", "@WithParentInjector"], | ||
["annotation", "@Spec"], | ||
["annotation", "@Override"], | ||
["annotation", "@Promisifiable"], | ||
["annotation", "@Promisify"], | ||
["annotation", "@This"], | ||
["annotation", "@N4JS"], | ||
["annotation", "@IgnoreImplementation"], | ||
["annotation", "@Global"], | ||
["annotation", "@ProvidedByRuntime"], | ||
["annotation", "@TestAPI"], | ||
["annotation", "@Polyfill"], | ||
["annotation", "@StaticPolyfill"], | ||
["annotation", "@StaticPolyfillAware"], | ||
["annotation", "@StaticPolyfillModule"], | ||
["annotation", "@Transient"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Test for annotations. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
any | ||
Array | ||
boolean | ||
break | ||
case | ||
catch | ||
class; | ||
const | ||
constructor | ||
continue | ||
debugger | ||
declare | ||
default | ||
delete | ||
do | ||
else | ||
enum | ||
export | ||
extends; | ||
false | ||
finally | ||
for | ||
from | ||
function | ||
get | ||
if | ||
implements; | ||
import | ||
in | ||
instanceof; | ||
interface; | ||
let | ||
module | ||
new; | ||
null | ||
number | ||
package | ||
private | ||
protected | ||
public | ||
return | ||
set | ||
static | ||
string | ||
super | ||
switch | ||
this | ||
throw | ||
true | ||
try | ||
typeof | ||
var | ||
void | ||
while | ||
with | ||
yield | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["keyword", "any"], | ||
["keyword", "Array"], | ||
["keyword", "boolean"], | ||
["keyword", "break"], | ||
["keyword", "case"], | ||
["keyword", "catch"], | ||
["keyword", "class"], ["punctuation", ";"], | ||
["keyword", "const"], | ||
["keyword", "constructor"], | ||
["keyword", "continue"], | ||
["keyword", "debugger"], | ||
["keyword", "declare"], | ||
["keyword", "default"], | ||
["keyword", "delete"], | ||
["keyword", "do"], | ||
["keyword", "else"], | ||
["keyword", "enum"], | ||
["keyword", "export"], | ||
["keyword", "extends"], ["punctuation", ";"], | ||
["keyword", "false"], | ||
["keyword", "finally"], | ||
["keyword", "for"], | ||
["keyword", "from"], | ||
["keyword", "function"], | ||
["keyword", "get"], | ||
["keyword", "if"], | ||
["keyword", "implements"], ["punctuation", ";"], | ||
["keyword", "import"], | ||
["keyword", "in"], | ||
["keyword", "instanceof"], ["punctuation", ";"], | ||
["keyword", "interface"], ["punctuation", ";"], | ||
["keyword", "let"], | ||
["keyword", "module"], | ||
["keyword", "new"], ["punctuation", ";"], | ||
["keyword", "null"], | ||
["keyword", "number"], | ||
["keyword", "package"], | ||
["keyword", "private"], | ||
["keyword", "protected"], | ||
["keyword", "public"], | ||
["keyword", "return"], | ||
["keyword", "set"], | ||
["keyword", "static"], | ||
["keyword", "string"], | ||
["keyword", "super"], | ||
["keyword", "switch"], | ||
["keyword", "this"], | ||
["keyword", "throw"], | ||
["keyword", "true"], | ||
["keyword", "try"], | ||
["keyword", "typeof"], | ||
["keyword", "var"], | ||
["keyword", "void"], | ||
["keyword", "while"], | ||
["keyword", "with"], | ||
["keyword", "yield"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Tests N4JS keywords. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
: any | ||
: boolean | ||
: enum | ||
: function | ||
: Function | ||
: int | ||
: null | ||
: number | ||
: object | ||
: Object | ||
: string | ||
: symbol | ||
: undefined | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["type-annotation", ": any"], | ||
["type-annotation", ": boolean"], | ||
["type-annotation", ": enum"], | ||
["type-annotation", ": function"], | ||
["type-annotation", ": Function"], | ||
["type-annotation", ": int"], | ||
["type-annotation", ": null"], | ||
["type-annotation", ": number"], | ||
["type-annotation", ": object"], | ||
["type-annotation", ": Object"], | ||
["type-annotation", ": string"], | ||
["type-annotation", ": symbol"], | ||
["type-annotation", ": undefined"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Test for type annotations. |