Skip to content

Instantly share code, notes, and snippets.

@Zegnat
Created February 25, 2017 21:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zegnat/e588ca858337e60ae43e408667142e31 to your computer and use it in GitHub Desktop.
Save Zegnat/e588ca858337e60ae43e408667142e31 to your computer and use it in GitHub Desktop.
CodeMirror.defineSimpleMode('human_resource_machine', {
// The start state contains the rules that are intially used
start: [
// Possible header.
{
regex: /^-- HUMAN RESOURCE MACHINE PROGRAM --$/,
token: 'string'
},
// Comment definition.
{
regex: /^(DEFINE COMMENT)( )(\d+)$/,
token: ['keyword', null, 'number'],
next: 'comment'
},
// Commands.
{
regex: /([A-Z]+)( +)([0-9a-z]+)?/,
token: ['keyword', null, 'number']
}
],
// The comment block.
comment: [
{regex: /;$/, token: 'comment', next: 'start'},
{regex: /[^;]*/, token: 'comment'}
]
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment