How to use the chevrotain.defaultParserErrorProvider function in chevrotain

To help you get started, we’ve selected a few chevrotain examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github christianvoigt / argdown / packages / argdown-parser / src / ArgdownErrorMessageProvider.js View on Github external
import * as chevrotain from 'chevrotain';
import { ArgdownLexer } from './ArgdownLexer.js';
//import * as _ from 'lodash';

const defaultParserErrorProvider = chevrotain.defaultParserErrorProvider
const tokenMatcher = chevrotain.tokenMatcher;
//const EOF = chevrotain.EOF;
const MISSING_TEXT_CONTENT_ERROR = "Missing text content. "
    + "Please add a line of text or refer to an existing statement or argument instead by replacing the content in this line with [Statement Title] or  (without a colon). "
    + "If you want to define a statement ([Statement Title]:) or argument (:), the defining text content has to follow the defined element title without any empty lines in between.";
const INVALID_INFERENCE_ERROR = "Invalid inference. Inferences can either be marked by four hyphens (----) or have the following format: "
    + "--Inference Rule 1, Inference Rule 2 (my meta data property 1: 1, 2, 3; my meta data property 2: value) --";
const INVALID_METADATA_ERROR = "Invalid metadata statement. Metadata has the following format: (my meta data property 1: 1, 2, 3; my meta data property 2: value)";
const INVALID_RELATION_ERROR = "Invalid relation syntax. This may either be caused by a) an invalid relation parent or b) invalid indentation. a) Invalid relation parent: Only statements and arguments can have relations as child elements. b) Invalid Indentation tree: Please check that if there are preceding relations in this paragraph, there is at least one with equal or less indentation.";
const MISSING_RELATION_CONTENT_ERROR = "Missing relation content. Please define or refer to a statement or argument (you can define a statement by simply adding a line of text).";
const MISSING_INFERENCE_END_ERROR = "Invalid inference syntax. Please end your inference with two hyphens (--)";
const INVALID_INFERENCE_POSITION_ERROR = "Invalid inference position. An inference may only occur within an argument reconstruction, in which it is preceded by a premise and followed by a conclusion (both of which have to be numbered statements: '(1) Statement').";
const MISSING_INFERENCE_ERROR = "Missing inference. Use four hyphens (----) between two numbered statements to insert an inference in your reconstruction and mark the latter statement as a conclusion.";
const MISSING_CONCLUSION_ERROR = "Missing conclusion. Please add a numbered statement after the inference.";
const ARGUMENT_RECONSTRUCTION_POSITION_ERROR = "Invalid position of argument reconstruction. Make sure the argument reconstruction is preceded by an empty line.";
const INVALID_ARGUMENT_STATEMENT_CONTENT_ERROR = "Invalid statement content. An argument reference () or definition (:) can not be used as premise or conclusion within an argument reconstruction. Use statement references ([Statement Title]) or definitions ([Statement Title]:) instead.";
github christianvoigt / argdown / packages / argdown-core / src / ArgdownErrorMessageProvider.ts View on Github external
import * as chevrotain from "chevrotain";
import { TokenType, IToken, IParserErrorMessageProvider } from "chevrotain";
import * as ArgdownLexer from "./lexer";

//import * as _ from 'lodash';

const defaultParserErrorProvider = chevrotain.defaultParserErrorProvider;
const tokenMatcher = chevrotain.tokenMatcher;
//const EOF = chevrotain.EOF;
const MISSING_TEXT_CONTENT_ERROR =
  "Missing text content. " +
  "Please add a line of text or refer to an existing statement or argument instead by replacing the content in this line with [Statement Title] or  (without a colon). " +
  "If you want to define a statement ([Statement Title]:) or argument (:), the defining text content has to follow the defined element title without any empty lines in between.";
const INVALID_INFERENCE_ERROR =
  "Invalid inference. Inferences can either be marked by four hyphens (----) or have the following format: " +
  "--Inference Rule 1, Inference Rule 2 (my meta data property 1: 1, 2, 3; my meta data property 2: value) --";
const INVALID_RELATION_ERROR =
  "Invalid relation syntax. This may either be caused by a) an invalid relation parent or b) invalid indentation. a) Invalid relation parent: Only statements and arguments can have relations as child elements. b) Invalid Indentation tree: Please check that if there are preceding relations in this paragraph, there is at least one with equal or less indentation.";
const INVALID_INDENTATION_ERROR = "Invalid indentation.";
const MISSING_RELATION_CONTENT_ERROR =
  "Missing relation content. Please define or refer to a statement or argument (you can define a statement by simply adding a line of text).";
const MISSING_INFERENCE_END_ERROR = "Invalid inference syntax. Please end your inference with two hyphens (--)";
const INVALID_INFERENCE_POSITION_ERROR =