mirror of
https://github.com/adelphes/android-dev-ext.git
synced 2025-12-23 01:48:18 +00:00
support assert statement
This commit is contained in:
@@ -226,6 +226,9 @@ class SynchronizedStatement extends Statement {
|
|||||||
/** @type {Statement} */
|
/** @type {Statement} */
|
||||||
statement = null;
|
statement = null;
|
||||||
}
|
}
|
||||||
|
class AssertStatement extends Statement {
|
||||||
|
expression = null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {TokenList} tokens
|
* @param {TokenList} tokens
|
||||||
@@ -344,6 +347,12 @@ function statementKeyword(tokens, locals, method, imports, typemap) {
|
|||||||
s = new SynchronizedStatement();
|
s = new SynchronizedStatement();
|
||||||
synchronizedStatement(s, tokens, locals, method, imports, typemap);
|
synchronizedStatement(s, tokens, locals, method, imports, typemap);
|
||||||
break;
|
break;
|
||||||
|
case 'assert':
|
||||||
|
tokens.inc();
|
||||||
|
s = new AssertStatement();
|
||||||
|
s.expression = expression(tokens, locals, method, imports, typemap);
|
||||||
|
semicolon(tokens);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
s = new InvalidStatement();
|
s = new InvalidStatement();
|
||||||
addproblem(tokens, ParseProblem.Error(tokens.current, `Unexpected token: ${tokens.current.value}`));
|
addproblem(tokens, ParseProblem.Error(tokens.current, `Unexpected token: ${tokens.current.value}`));
|
||||||
@@ -2703,7 +2712,7 @@ function tokenize(source, offset = 0, length = source.length) {
|
|||||||
* \w+ word
|
* \w+ word
|
||||||
* ```
|
* ```
|
||||||
*/
|
*/
|
||||||
const word_re = /^(?:(true|false)|(this|super|null)|(int|long|short|byte|float|double|char|boolean|void)|(new)|(instanceof)|(public|private|protected|static|final|abstract|native|volatile|transient)|(if|else|while|for|do|try|catch|finally|switch|case|default|return|break|continue|throw|synchronized)|(class|enum|interface)|(package|import)|(.+))$/;
|
const word_re = /^(?:(true|false)|(this|super|null)|(int|long|short|byte|float|double|char|boolean|void)|(new)|(instanceof)|(public|private|protected|static|final|abstract|native|volatile|transient)|(if|else|while|for|do|try|catch|finally|switch|case|default|return|break|continue|throw|synchronized|assert)|(class|enum|interface)|(package|import)|(.+))$/;
|
||||||
const word_token_types = [
|
const word_token_types = [
|
||||||
'boolean-literal',
|
'boolean-literal',
|
||||||
'object-literal',
|
'object-literal',
|
||||||
|
|||||||
Reference in New Issue
Block a user