Qucs-S S-parameter Viewer & RF Synthesis Tools
Loading...
Searching...
No Matches
Classes | Functions | Variables
babel.messages.jslexer Namespace Reference

Classes

class  Token
 

Functions

list[tuple[str|None, re.Pattern[str]]] get_rules (bool jsx, bool dotted, bool template_string)
 
bool indicates_division (Token token)
 
str unquote_string (str string)
 
Generator[Token, None, None] tokenize (str source, bool jsx=True, bool dotted=True, bool template_string=True, int lineno=1)
 

Variables

list operators
 
dict escapes = {'b': '\b', 'f': '\f', 'n': '\n', 'r': '\r', 't': '\t'}
 
 name_re = re.compile(r'[\w$_][\w\d$_]*', re.UNICODE)
 
 dotted_name_re = re.compile(r'[\w$_][\w\d$_.]*[\w\d$_.]', re.UNICODE)
 
 division_re = re.compile(r'/=?')
 
 regex_re = re.compile(r'/(?:[^/\\]*(?:\\.[^/\\]*)*)/[a-zA-Z]*', re.DOTALL)
 
 line_re = re.compile(r'(\r\n|\n|\r)')
 
 line_join_re = re.compile(r'\\' + line_re.pattern)
 
 uni_escape_re = re.compile(r'[a-fA-F0-9]{1,4}')
 
 hex_escape_re = re.compile(r'[a-fA-F0-9]{1,2}')
 

Detailed Description

    babel.messages.jslexer
    ~~~~~~~~~~~~~~~~~~~~~~

    A simple JavaScript 1.5 lexer which is used for the JavaScript
    extractor.

    :copyright: (c) 2013-2025 by the Babel Team.
    :license: BSD, see LICENSE for more details.

Function Documentation

◆ get_rules()

list[tuple[str | None, re.Pattern[str]]] babel.messages.jslexer.get_rules ( bool  jsx,
bool  dotted,
bool  template_string 
)
Get a tokenization rule list given the passed syntax options.

Internal to this module.

◆ indicates_division()

bool babel.messages.jslexer.indicates_division ( Token  token)
A helper function that helps the tokenizer to decide if the current
token may be followed by a division operator.

◆ tokenize()

Generator[Token, None, None] babel.messages.jslexer.tokenize ( str  source,
bool   jsx = True,
bool   dotted = True,
bool   template_string = True,
int   lineno = 1 
)
Tokenize JavaScript/JSX source.  Returns a generator of tokens.

:param source: The JavaScript source to tokenize.
:param jsx: Enable (limited) JSX parsing.
:param dotted: Read dotted names as single name token.
:param template_string: Support ES6 template strings
:param lineno: starting line number (optional)

◆ unquote_string()

str babel.messages.jslexer.unquote_string ( str  string)
Unquote a string with JavaScript rules.  The string has to start with
string delimiters (``'``, ``"`` or the back-tick/grave accent (for template strings).)

Variable Documentation

◆ operators

list babel.messages.jslexer.operators
Initial value:
1= sorted([
2 '+', '-', '*', '%', '!=', '==', '<', '>', '<=', '>=', '=',
3 '+=', '-=', '*=', '%=', '<<', '>>', '>>>', '<<=', '>>=',
4 '>>>=', '&', '&=', '|', '|=', '&&', '||', '^', '^=', '(', ')',
5 '[', ']', '{', '}', '!', '--', '++', '~', ',', ';', '.', ':',
6], key=len, reverse=True)