Fix pascaligo highlighting.
This commit is contained in:
parent
4f409cfa1f
commit
cb00dd2eac
@ -15,49 +15,64 @@ const MarkdownBlock = CompLibrary.MarkdownBlock; /* Used to read markdown */
|
|||||||
const Container = CompLibrary.Container;
|
const Container = CompLibrary.Container;
|
||||||
const GridBlock = CompLibrary.GridBlock;
|
const GridBlock = CompLibrary.GridBlock;
|
||||||
|
|
||||||
const pascaligoHighlighting = `
|
|
||||||
function pascaligo(hljs) {
|
function pascaligo(hljs) {
|
||||||
return {
|
return {
|
||||||
case_insensitive: true,
|
// case_insensitive: true,
|
||||||
keywords: 'and begin block case const contains down else end fail for ' +
|
beginKeywords: '',
|
||||||
'from function if in is list map mod nil not of or patch ' +
|
keywords: {
|
||||||
'procedure record remove set skip step then to type var while'
|
keyword: 'and begin block case const contains down else end fail for ' +
|
||||||
,
|
'from function if in is list map mod nil not of or patch ' +
|
||||||
literal: 'true false unit int string some none',
|
'procedure record remove set skip step then to type var while with',
|
||||||
lexemes: '[a-z_]\\w*!?'
|
literal: 'true false unit int string some none bool nat list'
|
||||||
|
},
|
||||||
|
lexemes: '[a-zA-Z][a-zA-Z0-9_]*',
|
||||||
|
contains: [
|
||||||
|
hljs.C_LINE_COMMENT_MODE,
|
||||||
|
|
||||||
|
{
|
||||||
|
className: 'type',
|
||||||
|
begin: /[A-Z][a-z]+/
|
||||||
|
},
|
||||||
|
{
|
||||||
|
begin: /[*+-:;\(\)\{\}|\>\<]/,
|
||||||
|
// className: 'ignore'
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
|
||||||
|
hljs.registerLanguage('pascaligo', pascaligo);
|
||||||
|
|
||||||
|
|
||||||
const pre = "```";
|
const pre = "```";
|
||||||
|
|
||||||
const pascaligoExample = `${pre}pascaligo
|
const pascaligoExample = `${pre}pascaligo
|
||||||
// variant defining pseudo multi-entrypoint actions
|
// variant defining pseudo multi-entrypoint actions
|
||||||
type action is
|
type action is
|
||||||
| Increment
|
| Increment of int
|
||||||
| Decrement
|
| Decrement of int
|
||||||
|
|
||||||
function add(const a: int ; const b: int): int is
|
function add (const a : int ; const b : int) : int is
|
||||||
block { skip } with a + b
|
block { skip } with a + b
|
||||||
|
|
||||||
function subtract(const a: int ; const b: int): int is
|
function subtract (const a : int ; const b : int) : int is
|
||||||
block { skip } with a - b
|
block { skip } with a - b
|
||||||
|
|
||||||
// real entrypoint that re-routes the flow based on the action provided
|
// real entrypoint that re-routes the flow based
|
||||||
function main(const p: action ; const s: int): (list(operation) * int) is
|
// on the action provided
|
||||||
block { skip } with ((nil: list(operation)),
|
function main (const p : action ; const s : int) :
|
||||||
case p of
|
(list(operation) * int) is
|
||||||
|
block { skip } with ((nil : list(operation)),
|
||||||
|
case p of
|
||||||
| Increment(n) -> add(s, n)
|
| Increment(n) -> add(s, n)
|
||||||
| Decrement(n) -> subtract(s, n)
|
| Decrement(n) -> subtract(s, n)
|
||||||
end)
|
end)
|
||||||
${ pre} `;
|
${pre}`;
|
||||||
|
|
||||||
const cameligoExample = `${pre}ocaml
|
const cameligoExample = `${pre}ocaml
|
||||||
type storage = int
|
type storage = int
|
||||||
|
|
||||||
(* variant defining pseudo multi-entrypoint actions *)
|
(* variant defining pseudo multi-entrypoint actions *)
|
||||||
|
|
||||||
type action =
|
type action =
|
||||||
| Increment of int
|
| Increment of int
|
||||||
| Decrement of int
|
| Decrement of int
|
||||||
@ -67,14 +82,14 @@ let add (a: int) (b: int): int = a + b
|
|||||||
let subtract (a: int) (b: int): int = a - b
|
let subtract (a: int) (b: int): int = a - b
|
||||||
|
|
||||||
(* real entrypoint that re-routes the flow based on
|
(* real entrypoint that re-routes the flow based on
|
||||||
the action provided *)
|
the action provided *)
|
||||||
let%entry main(p : action) storage =
|
let%entry main(p : action) storage =
|
||||||
let storage =
|
let storage =
|
||||||
match p with
|
match p with
|
||||||
| Increment n -> add storage n
|
| Increment n -> add storage n
|
||||||
| Decrement n -> subtract storage n
|
| Decrement n -> subtract storage n
|
||||||
in (([] : operation list), storage)
|
in (([] : operation list), storage)
|
||||||
${ pre} `;
|
${pre}`;
|
||||||
|
|
||||||
const PascalLIGOTab = () => (
|
const PascalLIGOTab = () => (
|
||||||
<div
|
<div
|
||||||
@ -140,12 +155,7 @@ class HomeSplash extends React.Component {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
</div >
|
||||||
<script>
|
|
||||||
{pascaligoHighlighting}
|
|
||||||
hljs.registerLanguage('pascaligo', pascaligo);
|
|
||||||
</script>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
Loading…
Reference in New Issue
Block a user