-
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.
Xeora Language implementation (#1239)
- Loading branch information
Showing
13 changed files
with
440 additions
and
1 deletion.
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
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,114 @@ | ||
(function(Prism) { | ||
Prism.languages.xeora = Prism.languages.extend('markup', { | ||
'constant': { | ||
pattern: /\$(?:DomainContents|PageRenderDuration)\$/, | ||
inside: { | ||
'punctuation': { | ||
pattern: /\$/ | ||
} | ||
} | ||
}, | ||
'variable': { | ||
pattern: /\$@?(?:#+|[-+*~=^])?[\w.]+\$/, | ||
inside: { | ||
'punctuation': { | ||
pattern: /[$.]/ | ||
}, | ||
'operator': { | ||
pattern: /#+|[-+*~=^@]/ | ||
} | ||
} | ||
}, | ||
'function-inline': { | ||
pattern: /\$F:[-\w.]+\?[-\w.]+(?:,(?:\|?(?:[-#.^+*~]*(?:[\w+][^$]*)|=(?:[\S+][^$]*)|@[-#]*(?:\w+.)[\w+.]+)?)*)?\$/, | ||
inside: { | ||
'variable': { | ||
pattern: /(?:[,|])@?(?:#+|[-+*~=^])?[\w.]+/, | ||
inside: { | ||
'punctuation': { | ||
pattern: /[,.|]/ | ||
}, | ||
'operator': { | ||
pattern: /#+|[-+*~=^@]/ | ||
} | ||
} | ||
}, | ||
'punctuation': { | ||
pattern: /\$\w:|[$:?.,|]/ | ||
} | ||
}, | ||
alias: 'function' | ||
}, | ||
'function-block': { | ||
pattern: /\$XF:{[-\w.]+\?[-\w.]+(?:,(?:\|?(?:[-#.^+*~]*(?:[\w+][^$]*)|=(?:[\S+][^$]*)|@[-#]*(?:\w+.)[\w+.]+)?)*)?}:XF\$/, | ||
inside: { | ||
'punctuation': { | ||
pattern: /[$:{}?.,|]/ | ||
} | ||
}, | ||
alias: 'function' | ||
}, | ||
'directive-inline': { | ||
pattern: /\$\w(?:#\d+\+?)?(?:\[[-\w.]+])?:[-\/\w.]+\$/, | ||
inside: { | ||
'punctuation': { | ||
pattern: /\$(?:\w:|C(?:\[|#\d))?|[:{[\]]/, | ||
inside: { | ||
'tag': { | ||
pattern: /#\d/ | ||
} | ||
} | ||
} | ||
}, | ||
alias: 'function' | ||
}, | ||
'directive-block-open': { | ||
pattern: /\$\w+:{|\$\w(?:#\d+\+?)?(?:\[[-\w.]+])?:[-\w.]+:{(![A-Z]+)?/, | ||
inside: { | ||
'punctuation': { | ||
pattern: /\$(?:\w:|C(?:\[|#\d))?|[:{[\]]/, | ||
inside: { | ||
'tag': { | ||
pattern: /#\d/ | ||
} | ||
} | ||
}, | ||
'attribute': { | ||
pattern: /![A-Z]+$/, | ||
inside: { | ||
'punctuation': { | ||
pattern: /!/ | ||
} | ||
}, | ||
alias: 'keyword' | ||
} | ||
}, | ||
alias: 'function' | ||
}, | ||
'directive-block-separator': { | ||
pattern: /}:[-\w.]+:{/, | ||
inside: { | ||
'punctuation': { | ||
pattern: /[:{}]/ | ||
} | ||
}, | ||
alias: 'function' | ||
}, | ||
'directive-block-close': { | ||
pattern: /}:[-\w.]+\$/, | ||
inside: { | ||
'punctuation': { | ||
pattern: /[:{}$]/ | ||
} | ||
}, | ||
alias: 'function' | ||
} | ||
}); | ||
|
||
Prism.languages.insertBefore('inside', 'punctuation', { | ||
'variable': Prism.languages.xeora['function-inline'].inside['variable'] | ||
}, Prism.languages.xeora["function-block"]); | ||
|
||
Prism.languages.xeoracube = Prism.languages.xeora; | ||
|
||
}(Prism)); |
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,114 @@ | ||
<h1>Xeora</h1> | ||
<p>To use this language, use the class "language-xeora".</p> | ||
|
||
<h2>Special Constants</h2> | ||
<pre><code>$DomainContents$ | ||
$PageRenderDuration$</code></pre> | ||
|
||
<h2>Operators & Variables</h2> | ||
<pre><code>$SearchKey$ | ||
$^SearchKey$ | ||
$~SearchKey$ | ||
$-SearchKey$ | ||
$+SearchKey$ | ||
$=SearchKey$ | ||
$#SearchKey$ | ||
$##SearchKey$ | ||
|
||
$*SearchKey$ | ||
|
||
[email protected]$ | ||
$@#SearchObject.SearchProperty$ | ||
[email protected]$</code></pre> | ||
|
||
<h2>Controls</h2> | ||
<pre><code>$C:ControlID$ | ||
$C:ControlID:{ <!-- Something --> }:ControlID$ | ||
$C:ControlID:{ <!-- Something --> }:ControlID:{ <!-- Something (Alternative) --> }:ControlID$ | ||
|
||
Control with Parent | ||
$C[Control1]:Control2$ | ||
$C[Control2]:Control3:{ <!-- Something --> }:Control3$ | ||
$C[Control2]:Control3:{ <!-- Something --> }:Control3:{ <!-- Something (Alternative) --> }:Control3$ | ||
|
||
Control with Parent & Leveling | ||
$C#1[ParentControlID]:ControlID:{ <!-- Something --> }:ControlID$ | ||
|
||
All Control Tags has leveling specification; | ||
$C:LoopControl1:{ | ||
$#FirstLoopSQLField1$ | ||
|
||
$C:ControlID:{ <!-- Something --> }:ControlID$ | ||
|
||
$C:LoopControl2:{ | ||
$##FirstLoopSQLField1$ | ||
$#SecondLoopSQLField1$ | ||
|
||
$C#1:ControlID:{ <!-- Something --> }:ControlID$ | ||
}:LoopControl2$ | ||
}:LoopControl1$ | ||
|
||
XML setup on a Control in Controls.xml | ||
<Control id="[ControlID]"> | ||
<Type>[ControlType]</Type> | ||
|
||
<Bind>[ThemeID|AddonID]?[ControlClass].[FunctionName],SomeOperatorTags(seperated with |)</Bind> | ||
|
||
<BlockIDsToUpdate localupdate="True|False"> | ||
<BlockID>[BlockID]</BlockID> | ||
<BlockID>[BlockID]</BlockID> | ||
<BlockID>[BlockID]</BlockID> | ||
</BlockIDsToUpdate> | ||
|
||
<DefaultButtonID>[ControlID]</DefaultButtonID> | ||
|
||
<Text>[TextBox, Password value or Button Text]</Text> | ||
|
||
<Content>[Textarea Content]</Content> | ||
|
||
<Source>[Image URL]</Source> | ||
|
||
<Url>[Link URL]</Url> | ||
|
||
<Attributes> | ||
<Attribute key="[HTMLAttributeKey]">[AttributeValue]</Attributes> | ||
</Attributes> | ||
</Control></code></pre> | ||
|
||
<h2>Directives</h2> | ||
<pre><code>$T:TemplateID$ | ||
$L:TranslationID$ | ||
$P:TemplateID$</code></pre> | ||
|
||
<h2>Executable Functions</h2> | ||
<pre><code>$F:AddonLib1?GlobalControls.PrintOutSums$ | ||
$F:AddonLib1?GlobalControls.PrintOut,~FormField$ | ||
$F:AddonLib1?GlobalControls.SumNumbers,~FormField|=5$</code></pre> | ||
|
||
<h2>Client Side Function Binding</h2> | ||
<pre><code>$XF:{AddonLib1?GlobalControls.SumNumbers,~FormField|=5}:XF$</code></pre> | ||
|
||
<h2>Inline Statements</h2> | ||
<pre><code>$S:StatementID:{ <!-- C# Code --> }:StatementID$ | ||
$S:StatementID:{!NOCACHE <!-- C# Code --> }:StatementID$ | ||
|
||
$S:Statement1:{ | ||
int intvalue1 = 5; | ||
int intvalue2 = Integer.Parse("0" + $~FormValue$); | ||
|
||
return intvalue1 * intvalue2; | ||
}:Statement1$</code></pre> | ||
|
||
<h2>Request Blocks</h2> | ||
<pre><code>$H:RequestBlockID:{ <!-- Something --> }:RequestBlockID$ | ||
$H:RequestBlockID:{!RENDERONREQUEST <!-- Something --> }:RequestBlockID$</code></pre> | ||
|
||
<h2>Cache Block</h2> | ||
<pre><code>$PC:{ <!-- Page Content Part --> }:PC$</code></pre> | ||
|
||
<h2>Message Handling Block</h2> | ||
<pre><code>$MB:{ <!-- Message Output Content --> }:MB$ | ||
$MB:{ | ||
$#Message$ | ||
$#MessageType$ | ||
}:MB$</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
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,15 @@ | ||
$DomainContents$ | ||
$PageRenderDuration$ | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["constant", [ | ||
["punctuation", "$"], "DomainContents", ["punctuation", "$"]]], | ||
["constant", [ | ||
["punctuation", "$"], "PageRenderDuration", ["punctuation", "$"]]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for constants. |
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,12 @@ | ||
}:Control3$ | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["directive-block-close", [ | ||
["punctuation", "}"], ["punctuation", ":"], "Control3", ["punctuation", "$"]]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for directive-block-closes. |
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,30 @@ | ||
$C:Control2:{ | ||
$C#1:Control2:{ | ||
$C[ParentControl]:Control2:{ | ||
$C#1[ParentControl]:Control2:{ | ||
$S:Statement:{!NOCACHE | ||
$H:HttpRequest:{!RENDERONREQUEST | ||
$C:Control2:{!MESSAGETEMPLATE | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["directive-block-open", [ | ||
["punctuation", ["$C:"]], "Control2", ["punctuation", [":"]], ["punctuation", ["{"]]]], | ||
["directive-block-open", [ | ||
["punctuation", ["$C", ["tag", "#1"]]], ["punctuation", [":"]], "Control2", ["punctuation", [":"]], ["punctuation", ["{"]]]], | ||
["directive-block-open", [ | ||
["punctuation", ["$C["]], "ParentControl", ["punctuation", ["]"]], ["punctuation", [":"]], "Control2", ["punctuation", [":"]], ["punctuation", ["{"]]]], | ||
["directive-block-open", [ | ||
["punctuation", ["$C", ["tag", "#1"]]], ["punctuation", ["["]], "ParentControl", ["punctuation", ["]"]], ["punctuation", [":"]], "Control2", ["punctuation", [":"]], ["punctuation", ["{"]]]], | ||
["directive-block-open", [ | ||
["punctuation", ["$S:"]], "Statement", ["punctuation", [":"]], ["punctuation", ["{"]], ["attribute", [["punctuation", "!"], "NOCACHE"]]]], | ||
["directive-block-open", [ | ||
["punctuation", ["$H:"]], "HttpRequest", ["punctuation", [":"]], ["punctuation", ["{"]], ["attribute", [["punctuation", "!"], "RENDERONREQUEST"]]]], | ||
["directive-block-open", [ | ||
["punctuation", ["$C:"]], "Control2", ["punctuation", [":"]], ["punctuation", ["{"]], ["attribute", [["punctuation", "!"], "MESSAGETEMPLATE"]]]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for directive-block-opens. |
17 changes: 17 additions & 0 deletions
17
tests/languages/xeora/directive-block-separator_feature.test
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,17 @@ | ||
}:Control3:{ | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["directive-block-separator", [ | ||
["punctuation", "}"], | ||
["punctuation", ":"], | ||
"Control3", | ||
["punctuation", ":"], | ||
["punctuation", "{"] | ||
]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for functions. |
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,21 @@ | ||
$C:Control2$ | ||
$C#1:Control2$ | ||
$C[ParentControl]:Control2$ | ||
$C#1[ParentControl]:Control2$ | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["directive-inline", [ | ||
["punctuation", ["$C:"]], "Control2", ["punctuation", ["$"]]]], | ||
["directive-inline", [ | ||
["punctuation", ["$C", ["tag", "#1"]]], ["punctuation", [":"]], "Control2", ["punctuation", ["$"]]]], | ||
["directive-inline", [ | ||
["punctuation", ["$C["]], "ParentControl", ["punctuation", ["]"]], ["punctuation", [":"]], "Control2", ["punctuation", ["$"]]]], | ||
["directive-inline", [ | ||
["punctuation", ["$C", ["tag", "#1"]]], ["punctuation", ["["]], "ParentControl", ["punctuation", ["]"]], ["punctuation", [":"]], "Control2", ["punctuation", ["$"]]]] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Checks for directive-inlines. |
Oops, something went wrong.