hljs.registerLanguage('ergon', function(hljs) {
  return {
    name: 'Ergon',
    aliases: ['ergon', 'agont'],

    keywords: {
      keyword: `
        DECLARE TYPE EDGE RULE FUNCTION PROPERTY AXIOMATIC
        PARAMS RETURNS
        BEGIN_TICK END_TICK
        LET SET CREATE PRINT
        LOOP OVER DO END
        IF THEN ELSE
        RETURN CALL
        SAVE GRID LOAD VM LOCAL
        BRANCH SWITCH MAIN EXPORT PRUNE LIST DIFF
        FIND GET ADD REMOVE
        CONDITION EXPECTS CHANGED UNLESS AS
        FOR INFER
        FIELD REQUIRED OPTIONAL ROLE
        WHERE
        IS OF IN TO FROM WITH
        INCIDENT TARGET BASELINE
        AT TICK
        PROP BY ID
        NODE NODES EDGE EDGES
        WEIGHT PRIORITY
        LOGICAL STATEFUL WEIGHTED

        AND OR NOT
      `,

      type: 'string int float bool void',

      literal: 'TRUE FALSE',

      built_in: '@timeline @is_main @origin_tick @current_tick'
    },

    contains: [
      {
        scope: 'comment',
        begin: /\bNOTE\b/,
        end: '$'
      },

      hljs.QUOTE_STRING_MODE,
      hljs.NUMBER_MODE,

      {
        scope: 'variable',
        match: /\b[A-Z][A-Z0-9_]*\b/
      },

      {
        scope: 'title',
        match: /\b[a-z][a-zA-Z0-9_]*\b/
      },

      {
        scope: 'built_in',
        match: /@(timeline|is_main|origin_tick|current_tick)\b/
      },

      {
        scope: 'operator',
        match: /!=|<=|>=|=|<|>|\+|-|\*|\//
      }
    ]
  };
});
