Class Lexer
java.lang.Object
org.schabi.newpipe.extractor.utils.jsextractor.Lexer
JavaScript lexer that is able to parse JavaScript code and return its
tokens.
The algorithm for distinguishing between division operators and regex literals was taken from the RESS lexer.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classParsed token, containing the token and its position in the input string -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionContinue parsing and return the next tokenbooleanCheck if the parser is balanced (equal amount of open and closed parentheses and braces)
-
Constructor Details
-
Lexer
Create a new JavaScript lexer with the given source code- Parameters:
js- JavaScript code
-
-
Method Details
-
getNextToken
Continue parsing and return the next token- Returns:
- next token
- Throws:
ParsingException
-
isBalanced
public boolean isBalanced()Check if the parser is balanced (equal amount of open and closed parentheses and braces)- Returns:
- true if balanced
-