Skip to main content

RegExp Syntax Error

rascal-0.34.0

Synopsis

Syntax error in regular expression at run time

Types

data RuntimeException = RegExpSyntaxError(str message);

Usage

import Exception; (only needed when RegExpSyntaxError is used in catch)

Description

At the moment, the parsing and compilation of regular expression is done at run time. This exception is thrown when a syntactically incorrect regular expression is used.

Examples

The following regular expression /+/ is incorrect (maybe /a+/ was meant?):

rascal>/+/ := "aaaa";
|prompt:///|(7,6,<1,7>,<1,13>): Parse error in Dangling meta character '+' near index 0
+
^
Advice: |https://www.rascal-mpl.org/docs/Rascal/Errors/CompileTimeErrors/SyntaxError|
ok