Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ let package = Package(
cSettings: [
.headerSearchPath("."),
.headerSearchPath("lib"),
.headerSearchPath("lib/internal"),
.headerSearchPath("render"),
.headerSearchPath("render/internal"),
]
Expand All @@ -37,7 +36,6 @@ let package = Package(
cSettings: [
.headerSearchPath("../iosMath"),
.headerSearchPath("../iosMath/lib"),
.headerSearchPath("../iosMath/lib/internal"),
.headerSearchPath("../iosMath/render"),
.headerSearchPath("../iosMath/render/internal"),
]
Expand All @@ -49,7 +47,6 @@ let package = Package(
cSettings: [
.headerSearchPath("../iosMath"),
.headerSearchPath("../iosMath/lib"),
.headerSearchPath("../iosMath/lib/internal"),
.headerSearchPath("../iosMath/render"),
.headerSearchPath("../iosMath/render/internal"),
],
Expand Down
18 changes: 1 addition & 17 deletions iosMath.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

/* Begin PBXBuildFile section */
490465BF1D23DA8400F82033 /* MTTypesetterTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 490465BE1D23DA8400F82033 /* MTTypesetterTest.m */; };
C01DEC0DE20260726000003 /* MTModularArithmeticTest.m in Sources */ = {isa = PBXBuildFile; fileRef = C01DEC0DE20260726000002 /* MTModularArithmeticTest.m */; };
49A1B2C41D23DA8400F82033 /* MTInkWidthTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 49A1B2C31D23DA8400F82033 /* MTInkWidthTest.m */; };
490465C11D23DA8400F82033 /* MTFontManagerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 490465C01D23DA8400F82033 /* MTFontManagerTest.m */; };
492EED0817DAEDD200939107 /* MTFontManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 492EECFA17DAED9000939107 /* MTFontManager.m */; };
Expand Down Expand Up @@ -78,8 +77,6 @@

/* Begin PBXFileReference section */
490465BE1D23DA8400F82033 /* MTTypesetterTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTTypesetterTest.m; sourceTree = "<group>"; };
C01DEC0DE20260726000002 /* MTModularArithmeticTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTModularArithmeticTest.m; sourceTree = "<group>"; };
C01DEC0DE20260726000001 /* MTMacroParameterAtom.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTMacroParameterAtom.h; sourceTree = "<group>"; };
49A1B2C31D23DA8400F82033 /* MTInkWidthTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTInkWidthTest.m; sourceTree = "<group>"; };
490465C01D23DA8400F82033 /* MTFontManagerTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MTFontManagerTest.m; sourceTree = "<group>"; };
492EECF317DAED9000939107 /* MTMathListDisplay.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MTMathListDisplay.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -261,7 +258,6 @@
C01DEC0DE20260722000104 /* MTMathUILabelSizingTest.m */,
49B83EF517CF046A0014B739 /* MTMathListTest.m */,
490465BE1D23DA8400F82033 /* MTTypesetterTest.m */,
C01DEC0DE20260726000002 /* MTModularArithmeticTest.m */,
49A1B2C31D23DA8400F82033 /* MTInkWidthTest.m */,
490465C01D23DA8400F82033 /* MTFontManagerTest.m */,
49965F2417CBBA2700A555C5 /* Supporting Files */,
Expand Down Expand Up @@ -289,7 +285,7 @@
492EED0317DAEDB500939107 /* MTMathList.m */,
492EED0417DAEDB500939107 /* MTMathListBuilder.h */,
492EECFF17DAEDB500939107 /* MTMathListBuilder.m */,
C01DEC0DE20260726000004 /* internal */,
49DA6BC319A05F850086B19F /* MTUnicode.h */,
49DA6BC619A062A30086B19F /* MTUnicode.m */,
);
path = lib;
Expand Down Expand Up @@ -347,15 +343,6 @@
name = fonts;
sourceTree = "<group>";
};
C01DEC0DE20260726000004 /* internal */ = {
isa = PBXGroup;
children = (
C01DEC0DE20260726000001 /* MTMacroParameterAtom.h */,
49DA6BC319A05F850086B19F /* MTUnicode.h */,
);
path = internal;
sourceTree = "<group>";
};
49EEFD791D19B616002D15C4 /* internal */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -550,7 +537,6 @@
C01DEC0DE20260722000103 /* MTMathUILabelSizingTest.m in Sources */,
498730A817D548190041B02B /* MTMathListTest.m in Sources */,
490465BF1D23DA8400F82033 /* MTTypesetterTest.m in Sources */,
C01DEC0DE20260726000003 /* MTModularArithmeticTest.m in Sources */,
49A1B2C41D23DA8400F82033 /* MTInkWidthTest.m in Sources */,
490465C11D23DA8400F82033 /* MTFontManagerTest.m in Sources */,
);
Expand Down Expand Up @@ -649,7 +635,6 @@
HEADER_SEARCH_PATHS = (
"$(SRCROOT)/iosMath",
"$(SRCROOT)/iosMath/lib",
"$(SRCROOT)/iosMath/lib/internal",
"$(SRCROOT)/iosMath/render",
"$(SRCROOT)/iosMath/render/internal",
);
Expand Down Expand Up @@ -702,7 +687,6 @@
HEADER_SEARCH_PATHS = (
"$(SRCROOT)/iosMath",
"$(SRCROOT)/iosMath/lib",
"$(SRCROOT)/iosMath/lib/internal",
"$(SRCROOT)/iosMath/render",
"$(SRCROOT)/iosMath/render/internal",
);
Expand Down
52 changes: 0 additions & 52 deletions iosMath/lib/MTMathList.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,6 @@ typedef NS_ENUM(NSUInteger, MTMathAtomType)
/// sub-mlist (== TeX Ord noad with sub_mlist / KaTeX "ordgroup").
/// Script-capable (< kMTMathAtomBoundary); spaced as Ordinary.
kMTMathAtomOrdGroup = 21,
/// An unexpanded macro invocation (\pmod, \mod, \pod). Holds the command name,
/// its parsed arguments, and an argument-free golden template. Expanded away by
/// -[MTMathList finalized], so it never reaches the typesetter.
/// Script-capable (< kMTMathAtomBoundary): ^/_ attaches at parse time and is
/// transferred onto the expansion.
kMTMathAtomMacro = 22,

// Atoms after this point do not support subscripts or superscripts

Expand Down Expand Up @@ -694,52 +688,6 @@ typedef NS_ENUM(NSUInteger, MTStrikeStyle) {

@end

/** An unexpanded macro invocation.

`\pmod{n}` parses to exactly one `MTMacroAtom`, which keeps the raw list small
(trivial serialization, and `^`/`_` attach through the builder's shared tail).
It carries an argument-free `templateExpression` holding `#N` placeholders —
parsed once, at parse time — so it is not a second source of truth for
`arguments`: the expansion is re-derived from (`templateExpression`, current
`arguments`) every time `-[MTMathList finalized]` runs.

@note Expansion happens in list context, so `-[MTMacroAtom finalized]` on a lone
atom returns another macro atom rather than the expansion. Only
`-[MTMathList finalized]` expands.

@note Templates must be flat with respect to their placeholders (see
`templateExpression`). A composite template such as `\frac{#1}{#2}` cannot be
expressed, since substitution only reaches the top level. The built-in templates
all satisfy this — `\mkern8mu(\mathrm{mod}\mkern6mu#1)` keeps `#1` at the top
level because `(` and `)` are separate atoms — but a future user-facing
`\newcommand` would need substitution to descend into sub-lists first.
*/
@interface MTMacroAtom : MTMathAtom

/** The command name without the leading backslash, e.g. `@"pmod"`. */
@property (nonatomic, copy, readonly) NSString* command;

/** The parsed arguments, in order. The array identity is immutable; the contained
`MTMathList`s stay mutable and are owned by this atom (deep-copied at init). */
@property (nonatomic, copy, readonly) NSArray<MTMathList*>* arguments;

/** The golden expansion template: a raw (non-finalized) expression whose `#N`
references are placeholder atoms. Argument-free, and flat with respect to those
placeholders — a `#N` nested inside a sub-list trips an assert in the
initializer. */
@property (nonatomic, strong, readonly) MTMathList* templateExpression;

- (instancetype)initWithCommand:(NSString*)command
arguments:(NSArray<MTMathList*>*)arguments
templateExpression:(MTMathList*)templateExpression NS_DESIGNATED_INITIALIZER;

/// A macro atom has no valid zero-argument construction — command, arguments and
/// template are all required — so the generic initializer is unavailable. The
/// implementation additionally throws, to catch dynamic (`id`-typed) callers.
- (instancetype)initWithType:(MTMathAtomType)type value:(NSString*)value NS_UNAVAILABLE;

@end

/** An atom representing an table element. This atom is not like other
atoms and is not present in TeX. We use it to represent the `\halign` command
in TeX with some simplifications. This is used for matrices, equation
Expand Down
Loading
Loading