Module glyph

Module glyph 

Source
Expand description

Implement the @...@ constructs in the source code.

We use @...@ to represent the characters that ther TX-2 supports but which Unicode does not. For example, @sub_A@ which represents a subscripted letter A.

We use the word “glyph” to denote the characters in the source code. This includes spacing characters (Tab, Backspace, Space but not carriage return) but not shift codes (COLOR BLACK, SUPER, NORMAL, SUB, COLOR RED) or special keys which would not appear in source code (WORD EXAM, LINE FEED DOWN, LINE FEED UP, LOWER CASE, UPPER CASE, STOP).

We also do not include the NULLIFY character. This would certainly have been used in the input to the TX-2 assembler (“M4”) to indicate that a character on the paper tape was deleted (but punching out all the holes, setting all the bits to 1). But this would have no role in the preparation of source code on a modern computer system (e.g. with a text editor) so we don’t currently support this in the input.

Due to the complexities of lexing and representing the TX-2’s compound characters (see for example section 6-2.3 of the Users Handbook, “RULES FOR SYMEX FORMATION”) we might later include additinal glyphs to represent compound characters.

The [base::charset] module deals with similar things, but this module deals with concerns that are unique to the assembler itself (that is, concerns which are not relevant to the implementation of the TX-2 emulator).

Modules§

shape 🔒
Used to limit effect of allow(non_camel_case_types); probably not needed.

Structs§

Elevated 🔒
Indicates the super/sub/normal script of something.
Glyph 🔒
A character which might appear in source code.
GlyphMapByChar 🔒
Maps Unicode characters onto Glyph instances describing them.
NotInCharacterSet 🔒
Indicates that a Unicode character does not exist in the TX-2 character set.

Enums§

Unrecognised 🔒
Identifies a Unicode character or a @...@ glyph in the input which does not correspond to something understood by the M4 assembler.

Constants§

ALL_GLYPHS 🔒
Symbols understood by the M4 assembler (other than compound symbols).
GDEF 🔒
Used to save typing to provide defaults in the definitions in ALL_GLYPHS.

Statics§

GLYPH_MAP_BY_CHAR 🔒
Read-only shared instance of GlyphMapByChar.

Traits§

AsStr 🔒

Functions§

canonicalise_char 🔒
Additional mappings of Unicode input to prevent user confusion.
elevate 🔒
Create an instance of Elevated<T>.
glyph_from_name 🔒
Convert a Unicode string into Elevated<&'static Glyph>.
glyph_map 🔒
Return a reference to the shared instance of GlyphMapByChar.
glyph_of_char 🔒
Convert a superscript/subscript/normal Unicode character, if we recognise it, into Elevated<&'static Glyph>.
is_allowed_in_symex 🔒
Return true if this character is allowed in a symex (symbol name).
name_from_glyph 🔒
Convert a Unicode character into its @...@ synonym.