regexp: convert ParseTest and include in RegExpParsingTest

This commit is contained in:
Bas Leijdekkers
2016-06-28 16:26:32 +02:00
parent 109ea23bc8
commit f0afd421a6
9 changed files with 177 additions and 39 deletions
@@ -1,35 +0,0 @@
/*
* Copyright 2006 Sascha Weinreuter
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.intellij.lang.regexp;
public class ParseTest extends BaseParseTestCase {
//public void test0() throws Throwable {
// myFixture.testHighlighting("test0.regexp");
//}
public void test1() throws Throwable {
myFixture.testHighlighting("test1.regexp");
}
public void test2() throws Throwable {
myFixture.testHighlighting("test2.regexp");
}
public void test3() throws Throwable {
myFixture.testHighlighting("test3.regexp");
}
public void test4() throws Throwable {
myFixture.testHighlighting("test4.regexp");
}
}
@@ -319,4 +319,8 @@ public class RegExpParsingTest extends ParsingTestCase {
public void testBug8() throws IOException { doCodeTest(/* fixme */"a<weak_warning descr=\"Redundant character escape\">\\ </weak_warning>b"); }
public void testBug9() throws IOException { doCodeTest("(^|\\.)\\*(?=(\\.|$))"); }
public void testBug10() throws IOException { doCodeTest("\\h \\H \\v \\V"); }
public void testParse1() throws IOException { doCodeTest("123 | 456"); }
public void testParse2() throws IOException { doCodeTest("1**"); }
public void testParse3() throws IOException { doCodeTest("(([hH][tT]{2}[pP]|[fF][tT][pP])://)?[a-zA-Z0-9\\-]+(\\.[a-zA-Z0-9\\-]+)*"); }
}
+21
View File
@@ -0,0 +1,21 @@
REGEXP_FILE
RegExpPatternImpl: <123 | 456>
RegExpBranchImpl: <123 >
RegExpCharImpl: <1>
PsiElement(CHARACTER)('1')
RegExpCharImpl: <2>
PsiElement(CHARACTER)('2')
RegExpCharImpl: <3>
PsiElement(CHARACTER)('3')
RegExpCharImpl: < >
PsiElement(CHARACTER)(' ')
PsiElement(UNION)('|')
RegExpBranchImpl: < 456>
RegExpCharImpl: < >
PsiElement(CHARACTER)(' ')
RegExpCharImpl: <4>
PsiElement(CHARACTER)('4')
RegExpCharImpl: <5>
PsiElement(CHARACTER)('5')
RegExpCharImpl: <6>
PsiElement(CHARACTER)('6')
+11
View File
@@ -0,0 +1,11 @@
REGEXP_FILE
RegExpPatternImpl: <1*>
RegExpBranchImpl: <1*>
RegExpClosureImpl: <1*>
RegExpCharImpl: <1>
PsiElement(CHARACTER)('1')
RegExpQuantifierImpl: <*>
PsiElement(STAR)('*')
PsiErrorElement:Dangling metacharacter
<empty list>
PsiElement(STAR)('*')
+141
View File
@@ -0,0 +1,141 @@
REGEXP_FILE
RegExpPatternImpl: <(([hH][tT]{2}[pP]|[fF][tT][pP])://)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*>
RegExpBranchImpl: <(([hH][tT]{2}[pP]|[fF][tT][pP])://)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*>
RegExpClosureImpl: <(([hH][tT]{2}[pP]|[fF][tT][pP])://)?>
RegExpGroupImpl: <(([hH][tT]{2}[pP]|[fF][tT][pP])://)>
PsiElement(GROUP_BEGIN)('(')
RegExpPatternImpl: <([hH][tT]{2}[pP]|[fF][tT][pP])://>
RegExpBranchImpl: <([hH][tT]{2}[pP]|[fF][tT][pP])://>
RegExpGroupImpl: <([hH][tT]{2}[pP]|[fF][tT][pP])>
PsiElement(GROUP_BEGIN)('(')
RegExpPatternImpl: <[hH][tT]{2}[pP]|[fF][tT][pP]>
RegExpBranchImpl: <[hH][tT]{2}[pP]>
RegExpClassImpl: <[hH]>
PsiElement(CLASS_BEGIN)('[')
RegExpUnionImpl: <hH>
RegExpCharImpl: <h>
PsiElement(CHARACTER)('h')
RegExpCharImpl: <H>
PsiElement(CHARACTER)('H')
PsiElement(CLASS_END)(']')
RegExpClosureImpl: <[tT]{2}>
RegExpClassImpl: <[tT]>
PsiElement(CLASS_BEGIN)('[')
RegExpUnionImpl: <tT>
RegExpCharImpl: <t>
PsiElement(CHARACTER)('t')
RegExpCharImpl: <T>
PsiElement(CHARACTER)('T')
PsiElement(CLASS_END)(']')
RegExpQuantifierImpl: <{2}>
PsiElement(LBRACE)('{')
PsiElement(NUMBER)('2')
PsiElement(RBRACE)('}')
RegExpClassImpl: <[pP]>
PsiElement(CLASS_BEGIN)('[')
RegExpUnionImpl: <pP>
RegExpCharImpl: <p>
PsiElement(CHARACTER)('p')
RegExpCharImpl: <P>
PsiElement(CHARACTER)('P')
PsiElement(CLASS_END)(']')
PsiElement(UNION)('|')
RegExpBranchImpl: <[fF][tT][pP]>
RegExpClassImpl: <[fF]>
PsiElement(CLASS_BEGIN)('[')
RegExpUnionImpl: <fF>
RegExpCharImpl: <f>
PsiElement(CHARACTER)('f')
RegExpCharImpl: <F>
PsiElement(CHARACTER)('F')
PsiElement(CLASS_END)(']')
RegExpClassImpl: <[tT]>
PsiElement(CLASS_BEGIN)('[')
RegExpUnionImpl: <tT>
RegExpCharImpl: <t>
PsiElement(CHARACTER)('t')
RegExpCharImpl: <T>
PsiElement(CHARACTER)('T')
PsiElement(CLASS_END)(']')
RegExpClassImpl: <[pP]>
PsiElement(CLASS_BEGIN)('[')
RegExpUnionImpl: <pP>
RegExpCharImpl: <p>
PsiElement(CHARACTER)('p')
RegExpCharImpl: <P>
PsiElement(CHARACTER)('P')
PsiElement(CLASS_END)(']')
PsiElement(GROUP_END)(')')
RegExpCharImpl: <:>
PsiElement(CHARACTER)(':')
RegExpCharImpl: </>
PsiElement(CHARACTER)('/')
RegExpCharImpl: </>
PsiElement(CHARACTER)('/')
PsiElement(GROUP_END)(')')
RegExpQuantifierImpl: <?>
PsiElement(QUEST)('?')
RegExpClosureImpl: <[a-zA-Z0-9\-]+>
RegExpClassImpl: <[a-zA-Z0-9\-]>
PsiElement(CLASS_BEGIN)('[')
RegExpUnionImpl: <a-zA-Z0-9\->
RegExpCharRangeImpl: <a-z>
RegExpCharImpl: <a>
PsiElement(CHARACTER)('a')
PsiElement(MINUS)('-')
RegExpCharImpl: <z>
PsiElement(CHARACTER)('z')
RegExpCharRangeImpl: <A-Z>
RegExpCharImpl: <A>
PsiElement(CHARACTER)('A')
PsiElement(MINUS)('-')
RegExpCharImpl: <Z>
PsiElement(CHARACTER)('Z')
RegExpCharRangeImpl: <0-9>
RegExpCharImpl: <0>
PsiElement(CHARACTER)('0')
PsiElement(MINUS)('-')
RegExpCharImpl: <9>
PsiElement(CHARACTER)('9')
RegExpCharImpl: <\->
PsiElement(ESC_CHARACTER)('\-')
PsiElement(CLASS_END)(']')
RegExpQuantifierImpl: <+>
PsiElement(PLUS)('+')
RegExpClosureImpl: <(\.[a-zA-Z0-9\-]+)*>
RegExpGroupImpl: <(\.[a-zA-Z0-9\-]+)>
PsiElement(GROUP_BEGIN)('(')
RegExpPatternImpl: <\.[a-zA-Z0-9\-]+>
RegExpBranchImpl: <\.[a-zA-Z0-9\-]+>
RegExpCharImpl: <\.>
PsiElement(ESC_CHARACTER)('\.')
RegExpClosureImpl: <[a-zA-Z0-9\-]+>
RegExpClassImpl: <[a-zA-Z0-9\-]>
PsiElement(CLASS_BEGIN)('[')
RegExpUnionImpl: <a-zA-Z0-9\->
RegExpCharRangeImpl: <a-z>
RegExpCharImpl: <a>
PsiElement(CHARACTER)('a')
PsiElement(MINUS)('-')
RegExpCharImpl: <z>
PsiElement(CHARACTER)('z')
RegExpCharRangeImpl: <A-Z>
RegExpCharImpl: <A>
PsiElement(CHARACTER)('A')
PsiElement(MINUS)('-')
RegExpCharImpl: <Z>
PsiElement(CHARACTER)('Z')
RegExpCharRangeImpl: <0-9>
RegExpCharImpl: <0>
PsiElement(CHARACTER)('0')
PsiElement(MINUS)('-')
RegExpCharImpl: <9>
PsiElement(CHARACTER)('9')
RegExpCharImpl: <\->
PsiElement(ESC_CHARACTER)('\-')
PsiElement(CLASS_END)(']')
RegExpQuantifierImpl: <+>
PsiElement(PLUS)('+')
PsiElement(GROUP_END)(')')
RegExpQuantifierImpl: <*>
PsiElement(STAR)('*')
-1
View File
@@ -1 +0,0 @@
123 | 456
-1
View File
@@ -1 +0,0 @@
1*<error descr="Dangling metacharacter">*</error>
-1
View File
@@ -1 +0,0 @@
(([hH][tT]{2}[pP]|[fF][tT][pP])://)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*
-1
View File
@@ -1 +0,0 @@
(([hH][tT]{2}[pP]|[fF][tT][pP])://)?[a-zA-Z0-9\-]+(\.[a-zA-Z0-9\-]+)*