diff --git a/ts/input/tex/Configuration.ts b/ts/input/tex/Configuration.ts index f58ff2ebf..41cdda8d3 100644 --- a/ts/input/tex/Configuration.ts +++ b/ts/input/tex/Configuration.ts @@ -103,7 +103,7 @@ export class Configuration { * @param {string} name The package name. * @param {Object} config The configuration parameters: * Configuration for the TexParser consist of the following: - * * _handler_ configuration mapping handler types to lists of symbol mappings. + * * _handler_ configuration mapping handler types to lists of token mappings. * * _fallback_ configuration mapping handler types to fallback methods. * * _items_ for the StackItem factory. * * _tags_ mapping tagging configurations to tagging objects. diff --git a/ts/input/tex/MapHandler.ts b/ts/input/tex/MapHandler.ts index 742bdd1c5..aae71b95e 100644 --- a/ts/input/tex/MapHandler.ts +++ b/ts/input/tex/MapHandler.ts @@ -22,9 +22,8 @@ * @author v.sorge@mathjax.org (Volker Sorge) */ -import {AbstractSymbolMap, SymbolMap} from './SymbolMap.js'; +import {AbstractTokenMap, TokenMap} from './TokenMap.js'; import {ParseInput, ParseResult, ParseMethod} from './Types.js'; -// import {ParserConfiguration} from './Configuration.js'; import {PrioritizedList} from '../../util/PrioritizedList.js'; import {FunctionList} from '../../util/FunctionList.js'; @@ -37,26 +36,26 @@ export type FallbackConfig = {[P in HandlerType]?: ParseMethod}; export namespace MapHandler { - let maps: Map = new Map(); + let maps: Map = new Map(); /** - * Adds a new symbol map to the map handler. Might overwrite an existing - * symbol map of the same name. + * Adds a new token map to the map handler. Might overwrite an existing + * token map of the same name. * - * @param {SymbolMap} map Registers a new symbol map. + * @param {TokenMap} map Registers a new token map. */ - export let register = function(map: SymbolMap): void { + export let register = function(map: TokenMap): void { maps.set(map.name, map); }; /** - * Looks up a symbol map if it exists. + * Looks up a token map if it exists. * - * @param {string} name The name of the symbol map. - * @return {SymbolMap} The symbol map with the given name or null. + * @param {string} name The name of the token map. + * @return {TokenMap} The token map with the given name or null. */ - export let getMap = function(name: string): SymbolMap { + export let getMap = function(name: string): TokenMap { return maps.get(name); }; @@ -64,16 +63,16 @@ export namespace MapHandler { /** - * Class of symbol mappings that are active in a configuration. + * Class of token mappings that are active in a configuration. */ export class SubHandler { - private _configuration: PrioritizedList = new PrioritizedList(); + private _configuration: PrioritizedList = new PrioritizedList(); private _fallback: FunctionList = new FunctionList(); /** - * Adds a list of symbol maps to the handler. - * @param {string[]} maps The names of the symbol maps to add. + * Adds a list of token maps to the handler. + * @param {string[]} maps The names of the token maps to add. * @param {ParseMethod} fallback A fallback method. * @param {number} priority Optionally a priority. */ @@ -93,7 +92,7 @@ export class SubHandler { } /** - * Parses the given input with the first applicable symbol map. + * Parses the given input with the first applicable token map. * @param {ParseInput} input The input for the parser. * @return {ParseResult} The output of the parsing function. */ @@ -104,32 +103,32 @@ export class SubHandler { return result; } } - let [env, symbol] = input; - Array.from(this._fallback)[0].item(env, symbol); + let [env, token] = input; + Array.from(this._fallback)[0].item(env, token); } /** - * Maps a symbol to its "parse value" if it exists. + * Maps a token to its "parse value" if it exists. * - * @param {string} symbol The symbol to parse. + * @param {string} token The token to parse. * @return {T} A boolean, Character, or Macro. */ - public lookup(symbol: string): T { - let map = this.applicable(symbol) as AbstractSymbolMap; - return map ? map.lookup(symbol) : null; + public lookup(token: string): T { + let map = this.applicable(token) as AbstractTokenMap; + return map ? map.lookup(token) : null; } /** - * Checks if a symbol is contained in one of the symbol mappings of this + * Checks if a token is contained in one of the token mappings of this * configuration. * - * @param {string} symbol The symbol to parse. - * @return {boolean} True if the symbol is contained in the mapping. + * @param {string} token The token to parse. + * @return {boolean} True if the token is contained in the mapping. */ - public contains(symbol: string): boolean { - return this.applicable(symbol) ? true : false; + public contains(token: string): boolean { + return this.applicable(token) ? true : false; } @@ -146,13 +145,13 @@ export class SubHandler { /** - * Retrieves the first applicable symbol map in the configuration. - * @param {string} symbol The symbol to parse. - * @return {SymbolMap} A map that can parse the symbol. + * Retrieves the first applicable token map in the configuration. + * @param {string} token The token to parse. + * @return {TokenMap} A map that can parse the token. */ - public applicable(symbol: string): SymbolMap { + public applicable(token: string): TokenMap { for (let {item: map} of this._configuration) { - if (map.contains(symbol)) { + if (map.contains(token)) { return map; } } @@ -162,10 +161,10 @@ export class SubHandler { /** * Retrieves the map of the given name. - * @param {string} name Name of the symbol map. - * @return {SymbolMap} The map if it exists. + * @param {string} name Name of the token map. + * @return {TokenMap} The map if it exists. */ - public retrieve(name: string): SymbolMap { + public retrieve(name: string): TokenMap { for (let {item: map} of this._configuration) { if (map.name === name) { return map; @@ -191,8 +190,8 @@ export class SubHandlers { private map = new Map(); /** - * Adds a symbol map to the configuration if it exists. - * @param {string} name of the symbol map. + * Adds a token map to the configuration if it exists. + * @param {string} name of the token map. */ public add(handlers: HandlerConfig, fallbacks: FallbackConfig, priority: number = PrioritizedList.DEFAULTPRIORITY): void { @@ -229,11 +228,11 @@ export class SubHandlers { /** - * Retrieves a symbol map of the given name. - * @param {string} name Name of the symbol map. - * @return {SymbolMap} The map if it exists. O/w null. + * Retrieves a token map of the given name. + * @param {string} name Name of the token map. + * @return {TokenMap} The map if it exists. O/w null. */ - public retrieve(name: string): SymbolMap { + public retrieve(name: string): TokenMap { for (const handler of this.map.values()) { let map = handler.retrieve(name); if (map) { diff --git a/ts/input/tex/ParseMethods.ts b/ts/input/tex/ParseMethods.ts index d754890d4..212d0371c 100644 --- a/ts/input/tex/ParseMethods.ts +++ b/ts/input/tex/ParseMethods.ts @@ -22,7 +22,7 @@ * @author v.sorge@mathjax.org (Volker Sorge) */ -import {Symbol} from './Symbol.js'; +import {Token} from './Token.js'; import TexParser from './TexParser.js'; import NodeUtil from './NodeUtil.js'; import {TexConstant} from './TexConstants.js'; @@ -98,9 +98,9 @@ namespace ParseMethods { /** * Handle lower-case Greek (as an mi). * @param {TexParser} parser The current tex parser. - * @param {Symbol} mchar The parsed symbol. + * @param {Token} mchar The parsed token. */ - export function lcGreek(parser: TexParser, mchar: Symbol) { + export function lcGreek(parser: TexParser, mchar: Token) { const def = {mathvariant: parser.configuration.mathStyle(mchar.char) || MATHVARIANT.ITALIC}; // @test Greek const node = parser.create('token', 'mi', def, mchar.char); @@ -110,9 +110,9 @@ namespace ParseMethods { /** * Handle mathcharupper-case Greek in current family. * @param {TexParser} parser The current tex parser. - * @param {Symbol} mchar The parsed symbol. + * @param {Token} mchar The parsed token. */ - export function ucGreek(parser: TexParser, mchar: Symbol) { + export function ucGreek(parser: TexParser, mchar: Token) { const def = {mathvariant: parser.stack.env['font'] || parser.configuration.mathStyle(mchar.char, true) || MATHVARIANT.NORMAL}; @@ -124,9 +124,9 @@ namespace ParseMethods { /** * Handle normal mathchar (as an mi). * @param {TexParser} parser The current tex parser. - * @param {Symbol} mchar The parsed symbol. + * @param {Token} mchar The parsed token. */ - export function mathchar0mi(parser: TexParser, mchar: Symbol) { + export function mathchar0mi(parser: TexParser, mchar: Token) { const def = mchar.attributes || {mathvariant: MATHVARIANT.ITALIC}; const node = parser.create('token', 'mi', def, mchar.char); parser.Push(node); @@ -135,9 +135,9 @@ namespace ParseMethods { /** * Handle normal mathchar (as an mo). * @param {TexParser} parser The current tex parser. - * @param {Symbol} mchar The parsed symbol. + * @param {Token} mchar The parsed token. */ - export function mathchar0mo(parser: TexParser, mchar: Symbol) { + export function mathchar0mo(parser: TexParser, mchar: Token) { const def = mchar.attributes || {}; def['stretchy'] = false; // @test Large Set @@ -151,9 +151,9 @@ namespace ParseMethods { /** * Handle mathchar in current family. * @param {TexParser} parser The current tex parser. - * @param {Symbol} mchar The parsed symbol. + * @param {Token} mchar The parsed token. */ - export function mathchar7(parser: TexParser, mchar: Symbol) { + export function mathchar7(parser: TexParser, mchar: Token) { const def = mchar.attributes || {mathvariant: MATHVARIANT.NORMAL}; if (parser.stack.env['font']) { // @test MathChar7 Single Font @@ -167,9 +167,9 @@ namespace ParseMethods { /** * Handle delimiter. * @param {TexParser} parser The current tex parser. - * @param {Symbol} delim The parsed delimiter symbol. + * @param {Token} delim The parsed delimiter token. */ - export function delimiter(parser: TexParser, delim: Symbol) { + export function delimiter(parser: TexParser, delim: Token) { let def = delim.attributes || {}; // @test Fenced2, Delimiter (AMS) def = Object.assign({fence: false, stretchy: false}, def); diff --git a/ts/input/tex/TexParser.ts b/ts/input/tex/TexParser.ts index 4f8c3dd4a..7c05b94d6 100644 --- a/ts/input/tex/TexParser.ts +++ b/ts/input/tex/TexParser.ts @@ -33,7 +33,7 @@ import {MmlNode, AbstractMmlNode} from '../../core/MmlTree/MmlNode.js'; import {ParseInput, ParseResult} from './Types.js'; import ParseOptions from './ParseOptions.js'; import {StackItem, EnvList} from './StackItem.js'; -import {Symbol} from './Symbol.js'; +import {Token} from './Token.js'; import {OptionList} from '../../util/Options.js'; @@ -140,26 +140,26 @@ export default class TexParser { /** - * Maps a symbol to its "parse value" if it exists. + * Maps a token to its "parse value" if it exists. * @param {HandlerType} kind Configuration name. - * @param {string} symbol The symbol to parse. + * @param {string} token The token to parse. * @return {any} A boolean, Character, or Macro. */ - public lookup(kind: HandlerType, symbol: string): any { - return this.configuration.handlers.get(kind).lookup(symbol); + public lookup(kind: HandlerType, token: string): any { + return this.configuration.handlers.get(kind).lookup(token); } /** - * Checks if a symbol is contained in one of the symbol mappings of the + * Checks if a token is contained in one of the token mappings of the * specified kind. * @param {HandlerType} kind Configuration name. - * @param {string} symbol The symbol to parse. - * @return {boolean} True if the symbol is contained in the given types of - * symbol mapping. + * @param {string} token The token to parse. + * @return {boolean} True if the token is contained in the given types of + * token mapping. */ - public contains(kind: HandlerType, symbol: string): boolean { - return this.configuration.handlers.get(kind).contains(symbol); + public contains(kind: HandlerType, token: string): boolean { + return this.configuration.handlers.get(kind).contains(token); } @@ -237,8 +237,8 @@ export default class TexParser { * @return {string} The corresponding character. */ public convertDelimiter(c: string): string { - const symbol = this.lookup('delimiter', c) as Symbol; - return symbol ? symbol.char : null; + const token = this.lookup('delimiter', c) as Token; + return token ? token.char : null; } /** diff --git a/ts/input/tex/Symbol.ts b/ts/input/tex/Token.ts similarity index 62% rename from ts/input/tex/Symbol.ts rename to ts/input/tex/Token.ts index 20094900c..2bada726f 100644 --- a/ts/input/tex/Symbol.ts +++ b/ts/input/tex/Token.ts @@ -17,7 +17,7 @@ /** - * @fileoverview Symbol classes. + * @fileoverview Token classes. * * @author v.sorge@mathjax.org (Volker Sorge) */ @@ -26,22 +26,22 @@ import {Args, Attributes, ParseMethod} from './Types.js'; /** - * Symbol class + * Token class */ -class _Symbol { +export class Token { /** * @constructor - * @param {string} symbol The symbol parsed. + * @param {string} token The token parsed. * @param {string} char The corresponding translation. * @param {Attributes} attributes The attributes for the translation. */ - constructor(private _symbol: string, private _char: string, + constructor(private _token: string, private _char: string, private _attributes: Attributes) { } - public get symbol(): string { - return this._symbol; + public get token(): string { + return this._token; } public get char(): string { @@ -54,29 +54,20 @@ class _Symbol { } -/** - * This export avoids a problem with webpack where it uses the original Symbol - * and the Symbol class was included later in the file, which caused an error - * about the original Symbol being used before it was defined. This way, - * _Symbol is the class, and that is substituted for Symbol when it is used, - * so there is no problem with the webpacked version. - */ -export {_Symbol as Symbol} - export class Macro { /** * @constructor - * @param {string} symbol The symbol parsed - * @param {ParseMethod} func The parsing function for that symbol. + * @param {string} token The token parsed + * @param {ParseMethod} func The parsing function for that token. * @param {Args[]} args Additional arguments for the function. */ - constructor(private _symbol: string, private _func: ParseMethod, + constructor(private _token: string, private _func: ParseMethod, private _args: Args[] = []) { } - public get symbol(): string { - return this._symbol; + public get token(): string { + return this._token; } public get func(): ParseMethod { diff --git a/ts/input/tex/SymbolMap.ts b/ts/input/tex/TokenMap.ts similarity index 66% rename from ts/input/tex/SymbolMap.ts rename to ts/input/tex/TokenMap.ts index 3bb4399e4..0171f779f 100644 --- a/ts/input/tex/SymbolMap.ts +++ b/ts/input/tex/TokenMap.ts @@ -17,27 +17,27 @@ /** - * @fileoverview Symbol map classes. + * @fileoverview Token map classes. * * @author v.sorge@mathjax.org (Volker Sorge) */ import {Attributes, Args, ParseMethod, ParseInput, ParseResult} from './Types.js'; -import {Symbol, Macro} from './Symbol.js'; +import {Token, Macro} from './Token.js'; import {MapHandler} from './MapHandler.js'; /** - * SymbolMaps are the base components for the input parsers. + * TokenMaps are the base components for the input parsers. * * They provide a contains method that checks if a map is applicable (contains) - * a particular string. Implementing classes then perform the actual symbol - * parsing, from simple regular expression test, straight forward symbol mapping + * a particular string. Implementing classes then perform the actual token + * parsing, from simple regular expression test, straight forward token mapping * to transformational functionality on the parsed string. * * @interface */ -export interface SymbolMap { +export interface TokenMap { /** * @return {string} The name of the map. @@ -50,23 +50,23 @@ export interface SymbolMap { parser: ParseMethod; /** - * @param {string} symbol A symbol to parse. - * @return {boolean} True if the symbol map applies to the symbol. + * @param {string} token A token to parse. + * @return {boolean} True if the token map applies to the token. */ - contains(symbol: string): boolean; + contains(token: string): boolean; /** - * @param {string} symbol A symbol to parse. - * @return {ParseMethod} A parse method for the symbol. + * @param {string} token A token to parse. + * @return {ParseMethod} A parse method for the token. */ - parserFor(symbol: string): ParseMethod; + parserFor(token: string): ParseMethod; /** * @param {TexParser} env The current parser. - * @param {string} symbol A symbol to parse. - * @return {ParseResult} The parsed symbol and the rest of the string. + * @param {string} token A token to parse. + * @return {ParseResult} The parsed token and the rest of the string. */ - parse([env, symbol]: ParseInput): ParseResult; + parse([env, token]: ParseInput): ParseResult; } @@ -79,14 +79,14 @@ export function parseResult(result: ParseResult): ParseResult { } /** - * Abstract implementation of symbol maps. + * Abstract implementation of token maps. * @template T */ -export abstract class AbstractSymbolMap implements SymbolMap { +export abstract class AbstractTokenMap implements TokenMap { /** * @constructor - * @implements {SymbolMap} + * @implements {TokenMap} * @param {string} name Name of the mapping. * @param {ParseMethod} parser The parser for the mappiong. */ @@ -106,23 +106,23 @@ export abstract class AbstractSymbolMap implements SymbolMap { /** * @override */ - public abstract contains(symbol: string): boolean; + public abstract contains(token: string): boolean; /** * @override */ - public parserFor(symbol: string) { - return this.contains(symbol) ? this.parser : null; + public parserFor(token: string) { + return this.contains(token) ? this.parser : null; } /** * @override */ - public parse([env, symbol]: ParseInput) { - let parser = this.parserFor(symbol); - let mapped = this.lookup(symbol); + public parse([env, token]: ParseInput) { + let parser = this.parserFor(token); + let mapped = this.lookup(token); return (parser && mapped) ? parseResult(parser(env, mapped as any)) : null; } @@ -137,10 +137,10 @@ export abstract class AbstractSymbolMap implements SymbolMap { /** - * @param {string} symbol + * @param {string} token * @return {T} */ - public abstract lookup(symbol: string): T; + public abstract lookup(token: string): T; } @@ -149,11 +149,11 @@ export abstract class AbstractSymbolMap implements SymbolMap { /** * Regular expressions used for parsing strings. */ -export class RegExpMap extends AbstractSymbolMap { +export class RegExpMap extends AbstractTokenMap { /** * @constructor - * @extends {AbstractSymbolMap} + * @extends {AbstractTokenMap} * @param {string} name Name of the mapping. * @param {ParseMethod} parser The parser for the mappiong. * @param {RegExp} regexp The regular expression. @@ -166,16 +166,16 @@ export class RegExpMap extends AbstractSymbolMap { /** * @override */ - public contains(symbol: string) { - return this._regExp.test(symbol); + public contains(token: string) { + return this._regExp.test(token); } /** * @override */ - public lookup(symbol: string): string { - return this.contains(symbol) ? symbol : null; + public lookup(token: string): string { + return this.contains(token) ? token : null; } } @@ -184,54 +184,54 @@ export class RegExpMap extends AbstractSymbolMap { /** * Parse maps associate strings with parsing functionality. * @constructor - * @extends {AbstractSymbolMap} + * @extends {AbstractTokenMap} * @template K */ -export abstract class AbstractParseMap extends AbstractSymbolMap { +export abstract class AbstractParseMap extends AbstractTokenMap { private map: Map = new Map(); /** * @override */ - public lookup(symbol: string): K { - return this.map.get(symbol); + public lookup(token: string): K { + return this.map.get(token); } /** * @override */ - public contains(symbol: string) { - return this.map.has(symbol); + public contains(token: string) { + return this.map.has(token); } /** - * Sets mapping for a symbol. - * @param {string} symbol The symbol to map. - * @param {K} object The symbols value in the mapping's codomain. + * Sets mapping for a token. + * @param {string} token The token to map. + * @param {K} object The tokens value in the mapping's codomain. */ - public add(symbol: string, object: K) { - this.map.set(symbol, object); + public add(token: string, object: K) { + this.map.set(token, object); } /** - * Removes a symbol from the map - * @param {string} symbol The symbol to remove + * Removes a token from the map + * @param {string} token The token to remove */ - public remove(symbol: string) { - this.map.delete(symbol); + public remove(token: string) { + this.map.delete(token); } } /** - * Maps symbols that can all be parsed with the same method. + * Maps tokens that can all be parsed with the same method. * * @constructor * @extends {AbstractParseMap} */ -export class CharacterMap extends AbstractParseMap { +export class CharacterMap extends AbstractParseMap { /** * @constructor @@ -245,7 +245,7 @@ export class CharacterMap extends AbstractParseMap { for (const key of Object.keys(json)) { let value = json[key]; let [char, attrs] = (typeof(value) === 'string') ? [value, null] : value; - let character = new Symbol(key, char, attrs); + let character = new Token(key, char, attrs); this.add(key, character); } } @@ -254,7 +254,7 @@ export class CharacterMap extends AbstractParseMap { /** - * Maps symbols that are delimiters, that are all parsed with the same method. + * Maps tokens that are delimiters, that are all parsed with the same method. * * @constructor * @extends {CharacterMap} @@ -264,8 +264,8 @@ export class DelimiterMap extends CharacterMap { /** * @override */ - public parse([env, symbol]: ParseInput) { - return super.parse([env, '\\' + symbol]); + public parse([env, token]: ParseInput) { + return super.parse([env, '\\' + token]); } } @@ -302,8 +302,8 @@ export class MacroMap extends AbstractParseMap { /** * @override */ - public parserFor(symbol: string) { - let macro = this.lookup(symbol); + public parserFor(token: string) { + let macro = this.lookup(token); return macro ? macro.func : null; } @@ -311,13 +311,13 @@ export class MacroMap extends AbstractParseMap { /** * @override */ - public parse([env, symbol]: ParseInput) { - let macro = this.lookup(symbol); - let parser = this.parserFor(symbol); + public parse([env, token]: ParseInput) { + let macro = this.lookup(token); + let parser = this.parserFor(token); if (!macro || !parser) { return null; } - return parseResult(parser(env, macro.symbol, ...macro.args)); + return parseResult(parser(env, macro.token, ...macro.args)); } } @@ -334,15 +334,15 @@ export class CommandMap extends MacroMap { /** * @override */ - public parse([env, symbol]: ParseInput) { - let macro = this.lookup(symbol); - let parser = this.parserFor(symbol); + public parse([env, token]: ParseInput) { + let macro = this.lookup(token); + let parser = this.parserFor(token); if (!macro || !parser) { return null; } let saveCommand = env.currentCS; - env.currentCS = '\\' + symbol; - let result = parser(env, '\\' + macro.symbol, ...macro.args); + env.currentCS = '\\' + token; + let result = parser(env, '\\' + macro.token, ...macro.args); env.currentCS = saveCommand; return parseResult(result); } @@ -380,13 +380,13 @@ export class EnvironmentMap extends MacroMap { /** * @override */ - public parse([env, symbol]: ParseInput) { - let macro = this.lookup(symbol); - let envParser = this.parserFor(symbol); + public parse([env, token]: ParseInput) { + let macro = this.lookup(token); + let envParser = this.parserFor(token); if (!macro || !envParser) { return null; } - return parseResult(this.parser(env, macro.symbol, envParser, macro.args)); + return parseResult(this.parser(env, macro.token, envParser, macro.args)); } } diff --git a/ts/input/tex/Types.ts b/ts/input/tex/Types.ts index e35fd8599..eb97f845f 100644 --- a/ts/input/tex/Types.ts +++ b/ts/input/tex/Types.ts @@ -23,7 +23,7 @@ */ import {StackItem} from './StackItem.js'; -import {Symbol} from './Symbol.js'; +import {Token} from './Token.js'; import TexParser from './TexParser.js'; export type Args = boolean | number | string | null; @@ -35,4 +35,4 @@ export type Environment = Record; export type ParseInput = [TexParser, string]; export type ParseResult = void | boolean | StackItem; -export type ParseMethod = (parser: TexParser, c: string | Symbol | StackItem, ...rest: any[]) => ParseResult; +export type ParseMethod = (parser: TexParser, c: string | Token | StackItem, ...rest: any[]) => ParseResult; diff --git a/ts/input/tex/action/ActionConfiguration.ts b/ts/input/tex/action/ActionConfiguration.ts index 10978b619..779e6101c 100644 --- a/ts/input/tex/action/ActionConfiguration.ts +++ b/ts/input/tex/action/ActionConfiguration.ts @@ -24,7 +24,7 @@ import {Configuration} from '../Configuration.js'; import TexParser from '../TexParser.js'; -import {CommandMap} from '../SymbolMap.js'; +import {CommandMap} from '../TokenMap.js'; import {ParseMethod} from '../Types.js'; import BaseMethods from '../base/BaseMethods.js'; diff --git a/ts/input/tex/ams/AmsConfiguration.ts b/ts/input/tex/ams/AmsConfiguration.ts index 31d848122..04d0db0d8 100644 --- a/ts/input/tex/ams/AmsConfiguration.ts +++ b/ts/input/tex/ams/AmsConfiguration.ts @@ -27,7 +27,7 @@ import {MultlineItem, FlalignItem} from './AmsItems.js'; import {AbstractTags} from '../Tags.js'; import {NEW_OPS} from './AmsMethods.js'; import './AmsMappings.js'; -import {CommandMap} from '../SymbolMap.js'; +import {CommandMap} from '../TokenMap.js'; /** diff --git a/ts/input/tex/ams/AmsMappings.ts b/ts/input/tex/ams/AmsMappings.ts index 2d377a2a7..96e051ac7 100644 --- a/ts/input/tex/ams/AmsMappings.ts +++ b/ts/input/tex/ams/AmsMappings.ts @@ -24,7 +24,7 @@ */ import {AmsMethods} from './AmsMethods.js'; -import * as sm from '../SymbolMap.js'; +import * as sm from '../TokenMap.js'; import {TexConstant} from '../TexConstants.js'; import ParseMethods from '../ParseMethods.js'; import ParseUtil from '../ParseUtil.js'; diff --git a/ts/input/tex/ams/AmsMethods.ts b/ts/input/tex/ams/AmsMethods.ts index 26887d597..23d3169bd 100644 --- a/ts/input/tex/ams/AmsMethods.ts +++ b/ts/input/tex/ams/AmsMethods.ts @@ -31,8 +31,8 @@ import NodeUtil from '../NodeUtil.js'; import {TexConstant} from '../TexConstants.js'; import TexParser from '../TexParser.js'; import TexError from '../TexError.js'; -import {Macro} from '../Symbol.js'; -import {CommandMap} from '../SymbolMap.js'; +import {Macro} from '../Token.js'; +import {CommandMap} from '../TokenMap.js'; import {ArrayItem} from '../base/BaseItems.js'; import {FlalignItem} from './AmsItems.js'; import BaseMethods from '../base/BaseMethods.js'; diff --git a/ts/input/tex/amscd/AmsCdMappings.ts b/ts/input/tex/amscd/AmsCdMappings.ts index d3f500c6f..f9243cefd 100644 --- a/ts/input/tex/amscd/AmsCdMappings.ts +++ b/ts/input/tex/amscd/AmsCdMappings.ts @@ -17,22 +17,22 @@ /** - * @fileoverview Symbol mappings for the AMScd package. + * @fileoverview Token mappings for the AMScd package. * * @author v.sorge@mathjax.org (Volker Sorge) */ -import * as sm from '../SymbolMap.js'; +import * as tm from '../TokenMap.js'; import ParseMethods from '../ParseMethods.js'; import AmsCdMethods from './AmsCdMethods.js'; -new sm.EnvironmentMap('amscd_environment', ParseMethods.environment, +new tm.EnvironmentMap('amscd_environment', ParseMethods.environment, {CD: 'CD'}, AmsCdMethods); -new sm.CommandMap('amscd_macros', { +new tm.CommandMap('amscd_macros', { minCDarrowwidth: 'minCDarrowwidth', minCDarrowheight: 'minCDarrowheight', }, AmsCdMethods); -new sm.MacroMap('amscd_special', {'@': 'arrow'}, AmsCdMethods); +new tm.MacroMap('amscd_special', {'@': 'arrow'}, AmsCdMethods); diff --git a/ts/input/tex/autoload/AutoloadConfiguration.ts b/ts/input/tex/autoload/AutoloadConfiguration.ts index 4ccb3f4ef..bc103293f 100644 --- a/ts/input/tex/autoload/AutoloadConfiguration.ts +++ b/ts/input/tex/autoload/AutoloadConfiguration.ts @@ -24,8 +24,8 @@ import {Configuration, ParserConfiguration} from '../Configuration.js'; import TexParser from '../TexParser.js'; -import {CommandMap} from '../SymbolMap.js'; -import {Macro} from '../Symbol.js'; +import {CommandMap} from '../TokenMap.js'; +import {Macro} from '../Token.js'; import {TeX} from '../../tex.js'; import {RequireLoad, RequireConfiguration} from '../require/RequireConfiguration.js'; diff --git a/ts/input/tex/base/BaseConfiguration.ts b/ts/input/tex/base/BaseConfiguration.ts index 82adbeeaf..9c4e3b880 100644 --- a/ts/input/tex/base/BaseConfiguration.ts +++ b/ts/input/tex/base/BaseConfiguration.ts @@ -27,7 +27,7 @@ import {MapHandler} from '../MapHandler.js'; import TexError from '../TexError.js'; import NodeUtil from '../NodeUtil.js'; import TexParser from '../TexParser.js'; -import {CharacterMap} from '../SymbolMap.js'; +import {CharacterMap} from '../TokenMap.js'; import * as bitem from './BaseItems.js'; import {AbstractTags} from '../Tags.js'; import './BaseMappings.js'; diff --git a/ts/input/tex/base/BaseItems.ts b/ts/input/tex/base/BaseItems.ts index 4ff6d1f42..80f47637b 100644 --- a/ts/input/tex/base/BaseItems.ts +++ b/ts/input/tex/base/BaseItems.ts @@ -24,7 +24,7 @@ import {MapHandler} from '../MapHandler.js'; -import {CharacterMap} from '../SymbolMap.js'; +import {CharacterMap} from '../TokenMap.js'; import {entities} from '../../../util/Entities.js'; import {MmlNode, TextNode, TEXCLASS} from '../../../core/MmlTree/MmlNode.js'; import {MmlMo} from '../../../core/MmlTree/MmlNodes/mo.js'; diff --git a/ts/input/tex/base/BaseMappings.ts b/ts/input/tex/base/BaseMappings.ts index 4d6c65347..758fc1745 100644 --- a/ts/input/tex/base/BaseMappings.ts +++ b/ts/input/tex/base/BaseMappings.ts @@ -22,7 +22,7 @@ * @author v.sorge@mathjax.org (Volker Sorge) */ -import * as sm from '../SymbolMap.js'; +import * as sm from '../TokenMap.js'; import {TexConstant} from '../TexConstants.js'; import BaseMethods from './BaseMethods.js'; import ParseMethods from '../ParseMethods.js'; diff --git a/ts/input/tex/base/BaseMethods.ts b/ts/input/tex/base/BaseMethods.ts index 67833715e..5daf02501 100644 --- a/ts/input/tex/base/BaseMethods.ts +++ b/ts/input/tex/base/BaseMethods.ts @@ -24,7 +24,7 @@ import * as sitem from './BaseItems.js'; import {StackItem, EnvList} from '../StackItem.js'; -import {Macro} from '../Symbol.js'; +import {Macro} from '../Token.js'; import {ParseMethod} from '../Types.js'; import NodeUtil from '../NodeUtil.js'; import TexError from '../TexError.js'; diff --git a/ts/input/tex/bbox/BboxConfiguration.ts b/ts/input/tex/bbox/BboxConfiguration.ts index 0db73d3a9..d9acad94c 100644 --- a/ts/input/tex/bbox/BboxConfiguration.ts +++ b/ts/input/tex/bbox/BboxConfiguration.ts @@ -24,7 +24,7 @@ import {Configuration} from '../Configuration.js'; import TexParser from '../TexParser.js'; -import {CommandMap} from '../SymbolMap.js'; +import {CommandMap} from '../TokenMap.js'; import {ParseMethod} from '../Types.js'; import TexError from '../TexError.js'; diff --git a/ts/input/tex/boldsymbol/BoldsymbolConfiguration.ts b/ts/input/tex/boldsymbol/BoldsymbolConfiguration.ts index 337575acb..b0b3c6513 100644 --- a/ts/input/tex/boldsymbol/BoldsymbolConfiguration.ts +++ b/ts/input/tex/boldsymbol/BoldsymbolConfiguration.ts @@ -27,7 +27,7 @@ import {Configuration} from '../Configuration.js'; import NodeUtil from '../NodeUtil.js'; import TexParser from '../TexParser.js'; import {TexConstant} from '../TexConstants.js'; -import {CommandMap} from '../SymbolMap.js'; +import {CommandMap} from '../TokenMap.js'; import {ParseMethod} from '../Types.js'; import {NodeFactory} from '../NodeFactory.js'; import ParseOptions from '../ParseOptions.js'; diff --git a/ts/input/tex/braket/BraketMappings.ts b/ts/input/tex/braket/BraketMappings.ts index b6eb9fd45..e94a829c7 100644 --- a/ts/input/tex/braket/BraketMappings.ts +++ b/ts/input/tex/braket/BraketMappings.ts @@ -22,7 +22,7 @@ * @author v.sorge@mathjax.org (Volker Sorge) */ -import {CommandMap, MacroMap} from '../SymbolMap.js'; +import {CommandMap, MacroMap} from '../TokenMap.js'; import BraketMethods from './BraketMethods.js'; diff --git a/ts/input/tex/bussproofs/BussproofsMappings.ts b/ts/input/tex/bussproofs/BussproofsMappings.ts index 306245279..90b28208a 100644 --- a/ts/input/tex/bussproofs/BussproofsMappings.ts +++ b/ts/input/tex/bussproofs/BussproofsMappings.ts @@ -24,7 +24,7 @@ import BussproofsMethods from './BussproofsMethods.js'; import ParseMethods from '../ParseMethods.js'; -import {CommandMap, EnvironmentMap} from '../SymbolMap.js'; +import {CommandMap, EnvironmentMap} from '../TokenMap.js'; /** diff --git a/ts/input/tex/cancel/CancelConfiguration.ts b/ts/input/tex/cancel/CancelConfiguration.ts index 15f4e438b..8d7239f48 100644 --- a/ts/input/tex/cancel/CancelConfiguration.ts +++ b/ts/input/tex/cancel/CancelConfiguration.ts @@ -25,7 +25,7 @@ import {Configuration} from '../Configuration.js'; import TexParser from '../TexParser.js'; import {TexConstant} from '../TexConstants.js'; -import {CommandMap} from '../SymbolMap.js'; +import {CommandMap} from '../TokenMap.js'; import {ParseMethod} from '../Types.js'; import ParseUtil from '../ParseUtil.js'; import {ENCLOSE_OPTIONS} from '../enclose/EncloseConfiguration.js'; diff --git a/ts/input/tex/cases/CasesConfiguration.ts b/ts/input/tex/cases/CasesConfiguration.ts index 81372cbfb..9b24d491c 100644 --- a/ts/input/tex/cases/CasesConfiguration.ts +++ b/ts/input/tex/cases/CasesConfiguration.ts @@ -1,5 +1,5 @@ import {Configuration} from '../Configuration.js'; -import {EnvironmentMap, MacroMap} from '../SymbolMap.js'; +import {EnvironmentMap, MacroMap} from '../TokenMap.js'; import ParseUtil from '../ParseUtil.js'; import BaseMethods from '../base/BaseMethods.js'; import TexParser from '../TexParser.js'; diff --git a/ts/input/tex/centernot/CenternotConfiguration.ts b/ts/input/tex/centernot/CenternotConfiguration.ts index 89cc311aa..90c815222 100644 --- a/ts/input/tex/centernot/CenternotConfiguration.ts +++ b/ts/input/tex/centernot/CenternotConfiguration.ts @@ -26,7 +26,7 @@ import {Configuration} from '../Configuration.js'; import ParseOptions from '../ParseOptions.js'; import TexParser from '../TexParser.js'; import NodeUtil from '../NodeUtil.js'; -import {CommandMap} from '../SymbolMap.js'; +import {CommandMap} from '../TokenMap.js'; import BaseMethods from '../base/BaseMethods.js'; new CommandMap('centernot', { diff --git a/ts/input/tex/color/ColorConfiguration.ts b/ts/input/tex/color/ColorConfiguration.ts index 75ecd8f8a..48d0e77a4 100644 --- a/ts/input/tex/color/ColorConfiguration.ts +++ b/ts/input/tex/color/ColorConfiguration.ts @@ -22,7 +22,7 @@ */ -import {CommandMap} from '../SymbolMap.js'; +import {CommandMap} from '../TokenMap.js'; import {Configuration, ParserConfiguration} from '../Configuration.js'; import {ColorMethods} from './ColorMethods.js'; import {ColorModel} from './ColorUtil.js'; diff --git a/ts/input/tex/colortbl/ColortblConfiguration.ts b/ts/input/tex/colortbl/ColortblConfiguration.ts index d4d29df9c..e70142523 100644 --- a/ts/input/tex/colortbl/ColortblConfiguration.ts +++ b/ts/input/tex/colortbl/ColortblConfiguration.ts @@ -24,7 +24,7 @@ import {ArrayItem} from '../base/BaseItems.js'; import {Configuration, ParserConfiguration, ConfigurationHandler} from '../Configuration.js'; -import {CommandMap} from '../SymbolMap.js'; +import {CommandMap} from '../TokenMap.js'; import TexParser from '../TexParser.js'; import TexError from '../TexError.js'; diff --git a/ts/input/tex/colorv2/ColorV2Configuration.ts b/ts/input/tex/colorv2/ColorV2Configuration.ts index 708d25304..c8d88011d 100644 --- a/ts/input/tex/colorv2/ColorV2Configuration.ts +++ b/ts/input/tex/colorv2/ColorV2Configuration.ts @@ -21,7 +21,7 @@ * @author dpvc@mathjax.org (Davide P. Cervone) */ -import {CommandMap} from '../SymbolMap.js'; +import {CommandMap} from '../TokenMap.js'; import {Configuration} from '../Configuration.js'; import {ParseMethod} from '../Types.js'; import TexParser from '../TexParser.js'; diff --git a/ts/input/tex/configmacros/ConfigMacrosConfiguration.ts b/ts/input/tex/configmacros/ConfigMacrosConfiguration.ts index b13dee981..5e61d9b90 100644 --- a/ts/input/tex/configmacros/ConfigMacrosConfiguration.ts +++ b/ts/input/tex/configmacros/ConfigMacrosConfiguration.ts @@ -24,9 +24,9 @@ import {Configuration, ParserConfiguration} from '../Configuration.js'; import {expandable} from '../../../util/Options.js'; -import {CommandMap, EnvironmentMap, MacroMap} from '../SymbolMap.js'; +import {CommandMap, EnvironmentMap, MacroMap} from '../TokenMap.js'; import ParseMethods from '../ParseMethods.js'; -import {Macro} from '../Symbol.js'; +import {Macro} from '../Token.js'; import NewcommandMethods from '../newcommand/NewcommandMethods.js'; import {BeginEnvItem} from '../newcommand/NewcommandItems.js'; import BaseMethods from '../base/BaseMethods.js'; diff --git a/ts/input/tex/empheq/EmpheqConfiguration.ts b/ts/input/tex/empheq/EmpheqConfiguration.ts index a5de55cd1..c815f2a9d 100644 --- a/ts/input/tex/empheq/EmpheqConfiguration.ts +++ b/ts/input/tex/empheq/EmpheqConfiguration.ts @@ -24,7 +24,7 @@ import {Configuration} from '../Configuration.js'; -import {CommandMap, EnvironmentMap} from '../SymbolMap.js'; +import {CommandMap, EnvironmentMap} from '../TokenMap.js'; import ParseUtil from '../ParseUtil.js'; import TexParser from '../TexParser.js'; import TexError from '../TexError.js'; diff --git a/ts/input/tex/enclose/EncloseConfiguration.ts b/ts/input/tex/enclose/EncloseConfiguration.ts index 113cf0c2c..b3c4f8a22 100644 --- a/ts/input/tex/enclose/EncloseConfiguration.ts +++ b/ts/input/tex/enclose/EncloseConfiguration.ts @@ -24,7 +24,7 @@ import {Configuration} from '../Configuration.js'; import TexParser from '../TexParser.js'; -import {CommandMap} from '../SymbolMap.js'; +import {CommandMap} from '../TokenMap.js'; import {ParseMethod} from '../Types.js'; import ParseUtil from '../ParseUtil.js'; diff --git a/ts/input/tex/extpfeil/ExtpfeilConfiguration.ts b/ts/input/tex/extpfeil/ExtpfeilConfiguration.ts index 32196715b..679dcbb0f 100644 --- a/ts/input/tex/extpfeil/ExtpfeilConfiguration.ts +++ b/ts/input/tex/extpfeil/ExtpfeilConfiguration.ts @@ -25,7 +25,7 @@ import {Configuration, ParserConfiguration} from '../Configuration.js'; import TexParser from '../TexParser.js'; -import {CommandMap} from '../SymbolMap.js'; +import {CommandMap} from '../TokenMap.js'; import {ParseMethod} from '../Types.js'; import {AmsMethods} from '../ams/AmsMethods.js'; import NewcommandUtil from '../newcommand/NewcommandUtil.js'; diff --git a/ts/input/tex/gensymb/GensymbConfiguration.ts b/ts/input/tex/gensymb/GensymbConfiguration.ts index 43a3e3c74..b263cd6c6 100644 --- a/ts/input/tex/gensymb/GensymbConfiguration.ts +++ b/ts/input/tex/gensymb/GensymbConfiguration.ts @@ -23,18 +23,18 @@ */ import {Configuration} from '../Configuration.js'; -import {Symbol} from '../Symbol.js'; +import {Token} from '../Token.js'; import {TexConstant} from '../TexConstants.js'; -import {CharacterMap} from '../SymbolMap.js'; +import {CharacterMap} from '../TokenMap.js'; import TexParser from '../TexParser.js'; /** * Handle characters that are known units. * @param {TexParser} parser The current tex parser. - * @param {Symbol} mchar The parsed symbol. + * @param {Token} mchar The parsed token. */ -function mathcharUnit(parser: TexParser, mchar: Symbol) { +function mathcharUnit(parser: TexParser, mchar: Token) { const def = mchar.attributes || {}; def.mathvariant = TexConstant.Variant.NORMAL; def.class = 'MathML-Unit'; diff --git a/ts/input/tex/html/HtmlConfiguration.ts b/ts/input/tex/html/HtmlConfiguration.ts index f1ac8e4a2..163a832e7 100644 --- a/ts/input/tex/html/HtmlConfiguration.ts +++ b/ts/input/tex/html/HtmlConfiguration.ts @@ -23,7 +23,7 @@ */ import {Configuration} from '../Configuration.js'; -import {CommandMap} from '../SymbolMap.js'; +import {CommandMap} from '../TokenMap.js'; import HtmlMethods from './HtmlMethods.js'; diff --git a/ts/input/tex/mathtools/MathtoolsConfiguration.ts b/ts/input/tex/mathtools/MathtoolsConfiguration.ts index 10077e898..ca35c074b 100644 --- a/ts/input/tex/mathtools/MathtoolsConfiguration.ts +++ b/ts/input/tex/mathtools/MathtoolsConfiguration.ts @@ -22,7 +22,7 @@ */ import {Configuration} from '../Configuration.js'; -import {CommandMap} from '../SymbolMap.js'; +import {CommandMap} from '../TokenMap.js'; import NodeUtil from '../NodeUtil.js'; import {expandable} from '../../../util/Options.js'; import {ParserConfiguration} from '../Configuration.js'; diff --git a/ts/input/tex/mathtools/MathtoolsMappings.ts b/ts/input/tex/mathtools/MathtoolsMappings.ts index 173ba3fda..7e376c5fd 100644 --- a/ts/input/tex/mathtools/MathtoolsMappings.ts +++ b/ts/input/tex/mathtools/MathtoolsMappings.ts @@ -22,7 +22,7 @@ */ import ParseMethods from '../ParseMethods.js'; -import {CommandMap, EnvironmentMap, DelimiterMap} from '../SymbolMap.js'; +import {CommandMap, EnvironmentMap, DelimiterMap} from '../TokenMap.js'; import {TexConstant} from '../TexConstants.js'; import {MathtoolsMethods} from './MathtoolsMethods.js'; diff --git a/ts/input/tex/mathtools/MathtoolsUtil.ts b/ts/input/tex/mathtools/MathtoolsUtil.ts index 8396b8826..3ddde9b72 100644 --- a/ts/input/tex/mathtools/MathtoolsUtil.ts +++ b/ts/input/tex/mathtools/MathtoolsUtil.ts @@ -24,8 +24,8 @@ import {EqnArrayItem} from '../base/BaseItems.js'; import ParseUtil from '../ParseUtil.js'; import TexParser from '../TexParser.js'; import TexError from '../TexError.js'; -import {CommandMap} from '../SymbolMap.js'; -import {Macro} from '../Symbol.js'; +import {CommandMap} from '../TokenMap.js'; +import {Macro} from '../Token.js'; import ParseOptions from '../ParseOptions.js'; import {lookup} from '../../../util/Options.js'; import {MmlNode} from '../../../core/MmlTree/MmlNode.js'; diff --git a/ts/input/tex/mhchem/MhchemConfiguration.ts b/ts/input/tex/mhchem/MhchemConfiguration.ts index 0bcdcf123..30254642f 100644 --- a/ts/input/tex/mhchem/MhchemConfiguration.ts +++ b/ts/input/tex/mhchem/MhchemConfiguration.ts @@ -23,7 +23,7 @@ */ import {Configuration} from '../Configuration.js'; -import {CommandMap} from '../SymbolMap.js'; +import {CommandMap} from '../TokenMap.js'; import {ParseMethod} from '../Types.js'; import TexError from '../TexError.js'; import TexParser from '../TexParser.js'; diff --git a/ts/input/tex/newcommand/NewcommandConfiguration.ts b/ts/input/tex/newcommand/NewcommandConfiguration.ts index 3f76f857d..c9b09b6f3 100644 --- a/ts/input/tex/newcommand/NewcommandConfiguration.ts +++ b/ts/input/tex/newcommand/NewcommandConfiguration.ts @@ -27,7 +27,7 @@ import {BeginEnvItem} from './NewcommandItems.js'; import NewcommandUtil from './NewcommandUtil.js'; import './NewcommandMappings.js'; import ParseMethods from '../ParseMethods.js'; -import * as sm from '../SymbolMap.js'; +import * as sm from '../TokenMap.js'; /** diff --git a/ts/input/tex/newcommand/NewcommandMappings.ts b/ts/input/tex/newcommand/NewcommandMappings.ts index c03776fb5..32bfe8f6d 100644 --- a/ts/input/tex/newcommand/NewcommandMappings.ts +++ b/ts/input/tex/newcommand/NewcommandMappings.ts @@ -23,7 +23,7 @@ */ import NewcommandMethods from './NewcommandMethods.js'; -import {CommandMap} from '../SymbolMap.js'; +import {CommandMap} from '../TokenMap.js'; /** diff --git a/ts/input/tex/newcommand/NewcommandMethods.ts b/ts/input/tex/newcommand/NewcommandMethods.ts index aa279cbca..abf3670e4 100644 --- a/ts/input/tex/newcommand/NewcommandMethods.ts +++ b/ts/input/tex/newcommand/NewcommandMethods.ts @@ -26,8 +26,8 @@ import {ParseMethod} from '../Types.js'; import TexError from '../TexError.js'; import TexParser from '../TexParser.js'; -import * as sm from '../SymbolMap.js'; -import {Symbol, Macro} from '../Symbol.js'; +import * as sm from '../TokenMap.js'; +import {Token, Macro} from '../Token.js'; import BaseMethods from '../base/BaseMethods.js'; import ParseUtil from '../ParseUtil.js'; import {StackItem} from '../StackItem.js'; @@ -90,8 +90,8 @@ NewcommandMethods.MacroDef = function(parser: TexParser, name: string) { * Implements the \let command. * * All \let commands create either new delimiters or macros in the extension - * maps. In the latter case if the let binds a symbol we have to generate a - * macro with the appropriate parse methods from the SymbolMap. Otherwise we + * maps. In the latter case if the let binds a token we have to generate a + * macro with the appropriate parse methods from the TokenMap. Otherwise we * simply copy the macro under a new name. * * Let does not always work on special characters as TeX does. For example @@ -115,7 +115,7 @@ NewcommandMethods.Let = function(parser: TexParser, name: string) { if (c === '\\') { // @test Let Bar, Let Brace Equal Stretchy name = NewcommandUtil.GetCSname(parser, name); - let macro = handlers.get('delimiter').lookup('\\' + name) as Symbol; + let macro = handlers.get('delimiter').lookup('\\' + name) as Token; if (macro) { // @test Let Bar, Let Brace Equal Stretchy NewcommandUtil.addDelimiter(parser, '\\' + cs, macro.char, macro.attributes); @@ -129,14 +129,14 @@ NewcommandMethods.Let = function(parser: TexParser, name: string) { if (map instanceof sm.MacroMap) { // @test Def Let, Newcommand Let const macro = (map as sm.CommandMap).lookup(name) as Macro; - NewcommandUtil.addMacro(parser, cs, macro.func, macro.args, macro.symbol); + NewcommandUtil.addMacro(parser, cs, macro.func, macro.args, macro.token); return; } - macro = (map as sm.CharacterMap).lookup(name) as Symbol; - const newArgs = NewcommandUtil.disassembleSymbol(cs, macro); + macro = (map as sm.CharacterMap).lookup(name) as Token; + const newArgs = NewcommandUtil.disassembleToken(cs, macro); const method = (p: TexParser, _cs: string, ...rest: any[]) => { // @test Let Relet, Let Let, Let Circular Macro - const symb = NewcommandUtil.assembleSymbol(rest); + const symb = NewcommandUtil.assembleToken(rest); return map.parser(p, symb); }; NewcommandUtil.addMacro(parser, cs, method, newArgs); @@ -144,7 +144,7 @@ NewcommandMethods.Let = function(parser: TexParser, name: string) { } // @test Let Brace Equal, Let Caret parser.i++; - const macro = handlers.get('delimiter').lookup(c) as Symbol; + const macro = handlers.get('delimiter').lookup(c) as Token; if (macro) { // @test Let Paren Delim, Let Paren Stretchy NewcommandUtil.addDelimiter(parser, '\\' + cs, macro.char, macro.attributes); diff --git a/ts/input/tex/newcommand/NewcommandUtil.ts b/ts/input/tex/newcommand/NewcommandUtil.ts index db1386d8c..c07d5db70 100644 --- a/ts/input/tex/newcommand/NewcommandUtil.ts +++ b/ts/input/tex/newcommand/NewcommandUtil.ts @@ -26,30 +26,30 @@ import ParseUtil from '../ParseUtil.js'; import TexError from '../TexError.js'; import TexParser from '../TexParser.js'; -import {Macro, Symbol} from '../Symbol.js'; +import {Macro, Token} from '../Token.js'; import {Args, Attributes, ParseMethod} from '../Types.js'; -import * as sm from '../SymbolMap.js'; +import * as sm from '../TokenMap.js'; namespace NewcommandUtil { /** - * Transforms the attributes of a symbol into the arguments of a macro. E.g., - * Symbol('ell', 'l', {mathvariant: "italic"}) is turned into Macro arguments: + * Transforms the attributes of a token into the arguments of a macro. E.g., + * Token('ell', 'l', {mathvariant: "italic"}) is turned into Macro arguments: * ['ell', 'l', 'mathvariant', 'italic']. * - * @param {string} name The command name for the symbol. - * @param {Symbol} symbol The symbol associated with name. + * @param {string} name The command name for the token. + * @param {Token} token The token associated with name. * @return {Args[]} Arguments for a macro. */ - export function disassembleSymbol(name: string, symbol: Symbol): Args[] { - let newArgs = [name, symbol.char] as Args[]; + export function disassembleToken(name: string, token: Token): Args[] { + let newArgs = [name, token.char] as Args[]; // @test Let Relet, Let Let, Let Circular Macro - if (symbol.attributes) { + if (token.attributes) { // @test Let Relet - for (let key in symbol.attributes) { + for (let key in token.attributes) { newArgs.push(key); - newArgs.push(symbol.attributes[key] as Args); + newArgs.push(token.attributes[key] as Args); } } return newArgs; @@ -57,13 +57,13 @@ namespace NewcommandUtil { /** - * Assembles a symbol from a list of macro arguments. This is the inverse + * Assembles a token from a list of macro arguments. This is the inverse * method of the one above. * * @param {Args[]} args The arguments of the macro. - * @return {Symbol} The Symbol generated from the arguments.. + * @return {Token} The Token generated from the arguments.. */ - export function assembleSymbol(args: Args[]): Symbol { + export function assembleToken(args: Args[]): Token { // @test Let Relet, Let Let, Let Circular Macro let name = args[0] as string; let char = args[1] as string; @@ -72,7 +72,7 @@ namespace NewcommandUtil { // @test Let Relet attrs[args[i] as string] = args[i + 1]; } - return new Symbol(name, char, attrs); + return new Token(name, char, attrs); } /** @@ -281,7 +281,7 @@ namespace NewcommandUtil { export function addDelimiter(parser: TexParser, cs: string, char: string, attr: Attributes) { const handlers = parser.configuration.handlers; const handler = handlers.retrieve(NEW_DELIMITER) as sm.DelimiterMap; - handler.add(cs, new Symbol(cs, char, attr)); + handler.add(cs, new Token(cs, char, attr)); } /** @@ -290,14 +290,14 @@ namespace NewcommandUtil { * @param {string} cs The control sequence of the delimiter. * @param {ParseMethod} func The parse method for this macro. * @param {Args[]} attr The attributes needed for parsing. - * @param {string=} symbol Optionally original symbol for macro, in case it is + * @param {string=} token Optionally original token for macro, in case it is * different from the control sequence. */ export function addMacro(parser: TexParser, cs: string, func: ParseMethod, attr: Args[], - symbol: string = '') { + token: string = '') { const handlers = parser.configuration.handlers; const handler = handlers.retrieve(NEW_COMMAND) as sm.CommandMap; - handler.add(cs, new Macro(symbol ? symbol : cs, func, attr)); + handler.add(cs, new Macro(token ? token : cs, func, attr)); } diff --git a/ts/input/tex/physics/PhysicsMappings.ts b/ts/input/tex/physics/PhysicsMappings.ts index fbed5f4eb..30117a289 100644 --- a/ts/input/tex/physics/PhysicsMappings.ts +++ b/ts/input/tex/physics/PhysicsMappings.ts @@ -22,7 +22,7 @@ * @author v.sorge@mathjax.org (Volker Sorge) */ -import {EnvironmentMap, CommandMap, MacroMap, CharacterMap} from '../SymbolMap.js'; +import {EnvironmentMap, CommandMap, MacroMap, CharacterMap} from '../TokenMap.js'; import PhysicsMethods from './PhysicsMethods.js'; import {TexConstant} from '../TexConstants.js'; import ParseMethods from '../ParseMethods.js'; diff --git a/ts/input/tex/physics/PhysicsMethods.ts b/ts/input/tex/physics/PhysicsMethods.ts index af75df693..b348eae9c 100644 --- a/ts/input/tex/physics/PhysicsMethods.ts +++ b/ts/input/tex/physics/PhysicsMethods.ts @@ -30,7 +30,7 @@ import {TEXCLASS, MmlNode} from '../../../core/MmlTree/MmlNode.js'; import ParseUtil from '../ParseUtil.js'; import NodeUtil from '../NodeUtil.js'; import {NodeFactory} from '../NodeFactory.js'; -import {Macro} from '../Symbol.js'; +import {Macro} from '../Token.js'; import {AutoOpen} from './PhysicsItems.js'; @@ -539,8 +539,8 @@ PhysicsMethods.Bra = function(parser: TexParser, name: string) { parser.i++; // This ensures that bra-ket also works if \let bound versions of \ket. let cs = parser.GetCS(); - let symbol = parser.lookup('macro', cs) as Macro; - if (symbol && symbol.symbol === 'ket') { + let token = parser.lookup('macro', cs) as Macro; + if (token && token.token === 'ket') { hasKet = true; saveI = parser.i; starKet = parser.GetStar(); diff --git a/ts/input/tex/require/RequireConfiguration.ts b/ts/input/tex/require/RequireConfiguration.ts index 6585ed136..dda158976 100644 --- a/ts/input/tex/require/RequireConfiguration.ts +++ b/ts/input/tex/require/RequireConfiguration.ts @@ -24,7 +24,7 @@ import {Configuration, ParserConfiguration, ConfigurationHandler} from '../Configuration.js'; import TexParser from '../TexParser.js'; -import {CommandMap} from '../SymbolMap.js'; +import {CommandMap} from '../TokenMap.js'; import {ParseMethod} from '../Types.js'; import TexError from '../TexError.js'; import {TeX} from '../../tex.js'; diff --git a/ts/input/tex/setoptions/SetOptionsConfiguration.ts b/ts/input/tex/setoptions/SetOptionsConfiguration.ts index 05df7120d..a5dd47df7 100644 --- a/ts/input/tex/setoptions/SetOptionsConfiguration.ts +++ b/ts/input/tex/setoptions/SetOptionsConfiguration.ts @@ -25,10 +25,10 @@ import {Configuration, ConfigurationHandler, ParserConfiguration} from '../Configuration.js'; import {TeX} from '../../tex.js'; import TexParser from '../TexParser.js'; -import {CommandMap} from '../SymbolMap.js'; +import {CommandMap} from '../TokenMap.js'; import TexError from '../TexError.js'; import ParseUtil from '../ParseUtil.js'; -import {Macro} from '../Symbol.js'; +import {Macro} from '../Token.js'; import BaseMethods from '../base/BaseMethods.js'; import {expandable, isObject} from '../../../util/Options.js'; diff --git a/ts/input/tex/texhtml/TexHtmlConfiguration.ts b/ts/input/tex/texhtml/TexHtmlConfiguration.ts index 4c2c70185..f3eaa9d33 100644 --- a/ts/input/tex/texhtml/TexHtmlConfiguration.ts +++ b/ts/input/tex/texhtml/TexHtmlConfiguration.ts @@ -24,7 +24,7 @@ import {Configuration} from '../Configuration.js'; import TexParser from '../TexParser.js'; -import {MacroMap} from '../SymbolMap.js'; +import {MacroMap} from '../TokenMap.js'; import {ParseMethod} from '../Types.js'; import ParseOptions from '../ParseOptions.js'; import TexError from '../TexError.js'; diff --git a/ts/input/tex/textcomp/TextcompMappings.ts b/ts/input/tex/textcomp/TextcompMappings.ts index 5493875e9..3afc41d3a 100644 --- a/ts/input/tex/textcomp/TextcompMappings.ts +++ b/ts/input/tex/textcomp/TextcompMappings.ts @@ -23,7 +23,7 @@ */ -import {CommandMap} from '../SymbolMap.js'; +import {CommandMap} from '../TokenMap.js'; import {TexConstant} from '../TexConstants.js'; import {TextMacrosMethods} from '../textmacros/TextMacrosMethods.js'; import TexParser from '../TexParser.js'; diff --git a/ts/input/tex/textmacros/TextMacrosMappings.ts b/ts/input/tex/textmacros/TextMacrosMappings.ts index 5a770561a..f1d5a328e 100644 --- a/ts/input/tex/textmacros/TextMacrosMappings.ts +++ b/ts/input/tex/textmacros/TextMacrosMappings.ts @@ -22,7 +22,7 @@ * @author dpvc@mathjax.org (Davide P. Cervone) */ -import {MacroMap, CommandMap} from '../SymbolMap.js'; +import {MacroMap, CommandMap} from '../TokenMap.js'; import {TexConstant} from '../TexConstants.js'; import {TextMacrosMethods} from './TextMacrosMethods.js'; import {MATHSPACE} from '../../../util/lengths.js'; diff --git a/ts/input/tex/unicode/UnicodeConfiguration.ts b/ts/input/tex/unicode/UnicodeConfiguration.ts index 6ccdac181..81fc5f878 100644 --- a/ts/input/tex/unicode/UnicodeConfiguration.ts +++ b/ts/input/tex/unicode/UnicodeConfiguration.ts @@ -26,7 +26,7 @@ import {Configuration} from '../Configuration.js'; import {EnvList} from '../StackItem.js'; import TexParser from '../TexParser.js'; import TexError from '../TexError.js'; -import {CommandMap} from '../SymbolMap.js'; +import {CommandMap} from '../TokenMap.js'; import {ParseMethod} from '../Types.js'; import ParseUtil from '../ParseUtil.js'; import NodeUtil from '../NodeUtil.js'; diff --git a/ts/input/tex/units/UnitsConfiguration.ts b/ts/input/tex/units/UnitsConfiguration.ts index d83a86ad0..0f359540b 100644 --- a/ts/input/tex/units/UnitsConfiguration.ts +++ b/ts/input/tex/units/UnitsConfiguration.ts @@ -24,7 +24,7 @@ import {Configuration} from '../Configuration.js'; import TexParser from '../TexParser.js'; -import {CommandMap} from '../SymbolMap.js'; +import {CommandMap} from '../TokenMap.js'; import {ParseMethod} from '../Types.js'; // Namespace diff --git a/ts/input/tex/upgreek/UpgreekConfiguration.ts b/ts/input/tex/upgreek/UpgreekConfiguration.ts index e0dc3400e..6cb25225c 100644 --- a/ts/input/tex/upgreek/UpgreekConfiguration.ts +++ b/ts/input/tex/upgreek/UpgreekConfiguration.ts @@ -23,8 +23,8 @@ */ import {Configuration} from '../Configuration.js'; -import {Symbol} from '../Symbol.js'; -import {CharacterMap} from '../SymbolMap.js'; +import {Token} from '../Token.js'; +import {CharacterMap} from '../TokenMap.js'; import {TexConstant} from '../TexConstants.js'; import TexParser from '../TexParser.js'; @@ -32,9 +32,9 @@ import TexParser from '../TexParser.js'; /** * Handle greek mathchar as mi in normal variant. * @param {TexParser} parser The current tex parser. - * @param {Symbol} mchar The parsed symbol. + * @param {Token} mchar The parsed token. */ -function mathchar0miNormal(parser: TexParser, mchar: Symbol) { +function mathchar0miNormal(parser: TexParser, mchar: Token) { const def = mchar.attributes || {}; def.mathvariant = TexConstant.Variant.NORMAL; const node = parser.create('token', 'mi', def, mchar.char); diff --git a/ts/input/tex/verb/VerbConfiguration.ts b/ts/input/tex/verb/VerbConfiguration.ts index 53ff9a0cc..312816160 100644 --- a/ts/input/tex/verb/VerbConfiguration.ts +++ b/ts/input/tex/verb/VerbConfiguration.ts @@ -25,7 +25,7 @@ import {Configuration} from '../Configuration.js'; import {TexConstant} from '../TexConstants.js'; import TexParser from '../TexParser.js'; -import {CommandMap} from '../SymbolMap.js'; +import {CommandMap} from '../TokenMap.js'; import {ParseMethod} from '../Types.js'; import TexError from '../TexError.js';