mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-02 20:21:17 +00:00
eclipse plugin: add method in grammar tests for showing tokenisation
This commit is contained in:
parent
21469d1dda
commit
6380ed7373
@ -77,6 +77,13 @@ public abstract class WMLTests extends AbstractXtextTests
|
||||
}
|
||||
}
|
||||
|
||||
protected void showTokenisation(String input) {
|
||||
List<Token> tokens = getTokens(input);
|
||||
for (int i = 0; i < tokens.size(); i++) {
|
||||
Token token = tokens.get(i);
|
||||
System.out.println(getTokenType(token));
|
||||
}
|
||||
}
|
||||
/**
|
||||
* check that an input is not tokenised using a particular terminal rule
|
||||
* */
|
||||
|
@ -24,10 +24,6 @@ public class WMLTestsImpl extends WMLTests
|
||||
checkTokenisation("abc", ID);
|
||||
checkTokenisation("abc123", ID);
|
||||
checkTokenisation("abc_123", ID);
|
||||
|
||||
//fail as entity is a keyword
|
||||
failTokenisation("entity", ID);
|
||||
failTokenisation("A", ID);
|
||||
}
|
||||
public void testSLCOMMENT(){
|
||||
checkTokenisation("#comment", SL_COMMENT);
|
||||
@ -37,10 +33,10 @@ public class WMLTestsImpl extends WMLTests
|
||||
|
||||
public void testTokenSequences(){
|
||||
checkTokenisation("123 abc", ID, WS, ID);
|
||||
checkTokenisation("123 \t#comment\n abc", INT, WS, SL_COMMENT,WS,ID);
|
||||
checkTokenisation("123 \t#comment\n abc", ID, WS, SL_COMMENT,WS,ID);
|
||||
|
||||
//note that no white space is necessary!
|
||||
checkTokenisation("123abc", INT, ID);
|
||||
checkTokenisation("123abc", ID);
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user