const { makeLexer } = require("moo-ignore");
/** Tokens object: definitions */
const Tokens = {
  EOF: "__EOF__",
  WHITES: { match: /\s+/, lineBreaks: true },
  LINECOMMENTS: /#.*/,
  MULTILINECOMMENTS: { match: /\/[*](?:.|\n)*?[*]\//, lineBreaks: true },
  NUMBER: { match: /[-+]?\d+\.?\d*(?:[eE][-+]?\d+)?/, value: s => Number(s) },
  STRING: /"(?:[^"\\]|\\.)*"/,
  WORD: /[^\s(),"]+/,
  "(": "(",
  ")": ")",
  ",": ",",
  };

let lexer = makeLexer(Tokens, ["WHITES", "LINECOMMENTS", "MULTILINECOMMENTS"], { eof: true });

module.exports = { lexer };