Enhanced C#
Language of your choice: library documentation
|
The lexical macro processor. Main classes: LeMP.Compiler and LeMP.MacroProcessor.
More...
|
namespace | Prelude |
| Defines prelude macros, which are predefined macros that normally do not have to be explicitly imported before use (in LES or EC#).
|
|
namespace | Tests |
| Contains tests for the LeMP.MacroProcessor and for standard LeMP macros.
|
|
|
enum | MacroMode {
MacroMode.Normal = 0,
MacroMode.NoReprocessing = 1,
MacroMode.ProcessChildrenAfter = 2,
MacroMode.ProcessChildrenBefore = 4,
MacroMode.Passive = 8,
MacroMode.AllowDuplicates = 16,
MacroMode.DropRemainingListItems = 32,
MacroMode.MatchIdentifier = 64,
MatchIdentifierOrCall = 64,
MacroMode.MatchIdentifierOnly = 128,
MacroMode.MatchEveryLiteral = 0x1000,
MacroMode.MatchEveryCall = 0x2000,
MacroMode.MatchEveryIdentifier = 0x4000,
MacroMode.UseLogicalNameInErrorMessages = 0x8000,
MacroMode.PriorityFallbackMin = 0x100,
MacroMode.PriorityFallback = 0x300,
MacroMode.PriorityInternalFallback = 0x400,
MacroMode.PriorityNormal = 0x500,
MacroMode.PriorityInternalOverride = 0x600,
MacroMode.PriorityOverride = 0x700,
MacroMode.PriorityOverrideMax = 0x900,
MacroMode.PriorityMask = 0xF00
} |
| Flags that affect the way that LeMP.MacroProcessor uses a LexicalMacro. More...
|
|
The lexical macro processor. Main classes: LeMP.Compiler and LeMP.MacroProcessor.
◆ MacroMode
Flags that affect the way that LeMP.MacroProcessor uses a LexicalMacro.
Enumerator |
---|
Normal | The macro's result is reprocessed directly (this is the default behavior).
|
NoReprocessing | The macro's result (including children) is not processed further. This flag only takes effect when the macro accepts the input by returning a non-null result.
|
ProcessChildrenAfter | The macro's result is not reprocessed, but the result's children are processed. This flag only takes effect when the macro accepts the input by returning a non-null result.
|
ProcessChildrenBefore | The result is pre-processed before calling the macro, and not processed afterward (if the macro accepts the input by returning a non-null result).
|
Passive | It is normal for this macro not to change the code, so a warning should not be printed when the macro "rejects" the input by returning null.
|
AllowDuplicates | If this macro is ambiguous with one or more macro of the same priority, this flag blocks the ambiguity error message if all the macros produce equivalent results.
|
DropRemainingListItems | If this macro succeeds, all nodes after this one in the current attribute or statement/argument list are dropped.
This option may be used by macros that splice together the list of IMacroContext.RemainingNodes into their own result. It is more common, however, to set the IMacroContext.DropRemainingNodes property inside the macro.
|
MatchIdentifier | If this flag is present, the macro can match a plain identifier. By default, only calls can be treated as macros.
This flag does not prevent the macro from matching calls.
|
MatchIdentifierOnly | If this flag is present, the macro can match a plain identifier but cannot match calls.
|
MatchEveryLiteral | The macro will be called whenever any kind of literal is encountered (if its namespace is imported).
When a literal is encountered, it is processed as though the Passive flag were present on all macros that use this flag, because no macro should alter all literals.
|
MatchEveryCall | The macro will be called for every call node (if its namespace is imported).
When a macro with this flag is called, it is processed as though the Passive flag were present.
|
MatchEveryIdentifier | The macro will be called for every identifier node (if its namespace is imported).
When a macro with this flag is called, it is processed as though the Passive flag were present.
|
UseLogicalNameInErrorMessages | Tells LeMP not to mention the physical method that implements the macro. This improves error message clarity for user-defined macros, all of which share a single implementing method.
|
PriorityFallbackMin | Lowest priority. If this macro is ambiguous with another macro that doesn't have this flag, the results produced by the other macro are used (note: only one priority flag can be used at a time).
|
PriorityFallback | Low priority. If this macro is ambiguous with another macro that doesn't have this flag nor FallbackMin, the results produced by the other macro are used (note: only one priority flag can be used at a time).
|
PriorityInternalFallback | Used to order behavior of standard macros.
|
PriorityNormal | Normal priority (this is the default and does not need to be specified.)
|
PriorityInternalOverride | Used to order behavior of standard macros.
|
PriorityOverride | High priority. If this macro is ambiguous with another macro that doesn't have this flag nor OverrideAll, this macro takes precedence (note: only one priority flag can be used at a time).
|
PriorityOverrideMax | Highest priority. If this macro is ambiguous with another macro that doesn't have this flag, the results produced by this macro are used (note: only one priority flag can be used at a time).
|
PriorityMask | For internal use to isolate the priority of a macro.
|
◆ LexicalMacro()
Method signature of an LeMP macro.
- Parameters
-
node | The node that caused the macro to be invoked (includes the name of the macro itself, and any attributes applied to the macro) |
context | This is a dual-purpose object. Firstly, this object implements IMessageSink. if the input does not have a valid form, the macro rejects it by returning null. Before returning null, the macro should explain the reason for the rejection (including a pattern that the macro accepts) by writinga message to this object. Secondly, this object contains additional information including the ancestors of the current node and a list of "scoped properties" (see IMacroContext.) |
- Returns
- A node to replace the original
node
, or null if this macro rejects the input node. Returning null can allow a different macro to accept the node instead.
If there are multiple macros in scope with the same name, they are all called. Macro expansion succeeds if exactly one macro accepts the input. If no macros accept the input, the error message given by each macro is printed; if multiple macros accept the input, an ambiguity error is printed.
When the macro processor scans an assembly looking for macros, it requires ContainsMacrosAttribute on the containing class, and LexicalMacroAttribute on each macro in the class. The macros must be public static methods.
Referenced by LeMP.MacroInfo.GetMacros().
bool IsEnabled(Severity type)
Always returns true.
Definition: BasicSinks.cs:153
override T RGet(int index, int localCount)
Gets an item at distance 'index' from the back (beginning of a VList)
Definition: VListBlockOfTwo.cs:78
Encapsulates algorithms for a min-heap, i.e. a priority queue that always knows the smallest item and...
Definition: Heap.cs:239
bool Remove(byte[] key, int offset, int length, ref TValue oldValue)
Removes the specified key and associated value, returning true if the entry was found and removed.
Definition: CPByteTrie.cs:118
Set-combining operations: With, Without, Union, Intersect, Except, Xor.
Definition: ISetImm.cs:24
Unit tests for the Enhanced C# lexer, parser and printer.
Definition: AmbiguityTests.cs:9
int StartIndex
Location in the orginal source file where the token starts, or -1 for a synthetic token.
Definition: Token.cs:294
Either< L2, R2 > Select< L2, R2 >(Func< L, L2 > selectL, Func< R, R2 > selectR)
Converts an Either to another with different types.
static readonly Precedence StartExpr
Below lowest precedence.
Definition: EcsParserGrammar.out.cs:138
bool HasListChanging(AListBase< K, T > tree)
Allows derived classes of AListNode to fire the AListBase.ListChanging event.
Definition: AListNode.cs:281
A preprocessor usually inserted between the lexer and parser that inserts "indent",...
Definition: IndentTokenGenerator.cs:58
bool IsProperSubsetOf(MSet< T > other)
Definition: MSet.cs:272
Helper class for LinqToLists.
Definition: SelectCollection.out.cs:39
static Symbol For(string s)
Alias for GSymbol.Get(string). This function was introduced to match the equivalent ES6 API Symbol....
Definition: Symbol.cs:133
LNode PreProcessChildren()
Applies all available macros to the current node's children and returns the result.
bool TryGetValue(byte[] key, out TValue value)
Finds the specified key and gets its associated value, returning true if the key was found.
Definition: CPByteTrie.cs:127
virtual bool CallsMin(string name, int minArgCount)
Returns true if this is a call with the specified name and the specified minimum number of arguments.
Definition: LNode.cs:732
static void MuMove(WListProtected< T > w, int dffFrom, int dffTo, int count)
Moves a series of elements from one location to another in a mutable block.
Definition: VListBlock.cs:972
int AddRange(IEnumerable< T > e)
Adds a set of items to the list, one at a time.
Definition: BList.cs:215
override bool CallsMin(Symbol name, int argCount)
Returns true if this is a call with the specified name and the specified minimum number of arguments.
Definition: AbstractNodes.cs:142
LoopMode
Types of Alts objects.
Definition: Predicates.cs:746
static readonly ParsingMode FormalArguments
Tells IParsingService.Parse to treat the input as a formal argument list (parameter names with types)...
Definition: ParsingMode.cs:35
bool NoDefaultArm
Normally, the last arm in a list of alternatives is chosen as the default. For example,...
Definition: LLParserGenerator.cs:61
int? BlockChainLength
Gets the number of blocks used by this list.
Definition: VList.cs:296
int SignificantBits
Returns the normal maximum number of significant (mantissa) bits for this type (not counting the sign...
Definition: Interfaces.cs:135
static int BinarySearchByIndex< Anything >(Anything data, int count, Func< int, Anything, int > compare, bool lowerBound)
A binary search function that knows nothing about the list being searched.
Definition: InternalList.cs:587
bool ContainsEverything
Returns true iff the set covers all integers. This includes the common scenario that the set is empty...
Definition: IntSet.cs:227
Enumerates keys of a CPStringTrie.
Definition: CPStringTrie.cs:251
A fast, tiny 4-byte lock to support multiple readers or a single writer. Designed for low-contention,...
Definition: ThreadEx.cs:342
int Capacity
Gets or sets the array length.
Definition: InternalList.cs:93
Return value of CPStringTrie<T>.Keys.
Definition: CPStringTrie.cs:271
@ Other
For token types not covered by other token kinds.
static StringBuilder PrintMultiple(ILNodePrinter printer, IEnumerable< LNode > nodes, StringBuilder sb, IMessageSink sink, ParsingMode mode, ILNodePrinterOptions options)
Converts a sequences of LNodes to strings, adding a line separator between each.
Definition: ILNodePrinter.cs:65
A stripped-down NUnit lookalike which allows you to put simple unit tests in an assembly without havi...
Definition: NamespaceDocs.cs:94
static bool IsOpCharEx(char c)
Returns true if this character is one of those that can appear in "extended" LESv3 operators that sta...
Definition: LesPrecedenceMap.cs:216
void CopyTo(T[] array, int arrayIndex)
Copies the elements of the collection to an Array, starting at a particular array index.
Definition: ListSourceAsList.cs:75
int FindLowerBound(ref K key, out V value, out bool found)
Definition: BMultiMap.cs:371
bool CanAppearIn(Precedence context, bool prefix)
For use in printers. Returns true if an operator with this precedence can appear in the specified con...
Definition: Precedence.cs:284
int ExceptWith(InternalSet< T > other, IEqualityComparer< T > thisComparer)
Definition: InternalSet.cs:1400
static void ExpectListByEnumerator< T >(IReadOnlyList< T > list, params T[] expected)
When testing a buggy collection type, the enumerator might behave differently than the indexer,...
Definition: TestHelpers.cs:21
void VerifyCorrectness()
Definition: IndexedAList.cs:117
IPGTerminalSet WithEOF(bool wantEOF=true)
Adds or removes EOF from the set. If the set doesn't change, this method may return this.
static new readonly Symbol Async
[#async] Task Foo(); <=> async Task Foo();
Definition: EcsCodeSymbols.cs:19
A list of non-null references to LNode.
Definition: LNodeList.cs:33
void Push(T item)
Adds an item to the heap. Complexity: O(Count).
Definition: Heap.cs:91
Please use the new name of this class: LineAndColumn. Holds a line number (Line) and a position in th...
Definition: SourcePos.cs:26
IRange< T > Slice(int start, int count=int.MaxValue)
Returns a sub-range of this list.
Definition: NegList.cs:109
static LNode ParseSingle(this IParsingService parser, UString expr, IMessageSink msgs, IParsingOptions options)
Parses a string and expects exactly one output.
Definition: IParsingService.cs:258
A class that implements this interface will generate small bits of code that the parser generator wil...
Definition: IPGCodeGenHelper.cs:25
bool Join(int milliseconds)
Blocks the calling thread until a thread terminates or the specified time elapses,...
Definition: ThreadEx.cs:266
static void Contains(object expected, IEnumerable actual, string message, params object[] args)
Asserts that an object is contained in a list.
Definition: MiniTest.cs:970
static object Cache(ushort o)
Special overload to avoid treating argument as int32 in C#.
Definition: CG.cs:56
Marks a class to be searched for macros.
Definition: MacroAttributes.cs:44
int LineToIndex(int lineNo)
Returns the index in a source file of the beginning of the specified line, where the first line is nu...
Definition: EmptySourceFile.cs:41
delegate XfAction VListTransformer< T >(int i, ref T item)
User-supplied list transformer function.
Performs prediction analysis using the visitor pattern to visit the predicates in a rule....
Definition: AnalysisVisitors.cs:30
void SwapHelper(AListBase< K, T > other, bool swapObservers)
Swaps two ALists.
Definition: AListBase.cs:1068
char? ExampleChar(IPGTerminalSet set)
Returns an example of a character in the set, or null if this is not a set of characters or if EOF is...
static FormatterDelegate?? GlobalDefaultFormatter
Gets or sets the formatter used when one has not been assigned to the current thread with SetFormatte...
Definition: Localize.cs:211
ILexer< Token > Tokenize(ICharSource text, string fileName, IMessageSink msgs, IParsingOptions options)
Returns a lexer that is configured to begin reading the specified file.
Definition: Les2LanguageService.cs:55
void Write(Severity level, TContext context, [Localizable] string format)
Writes a message to the target that this object represents.
virtual new void Reset(CharSrc source, string fileName="", int inputPosition=0, bool newSourceFile=true)
Reinitializes the object. This method is called by the constructor.
Definition: LexerSource.cs:62
override bool HasSimpleHeadWithoutPAttrs()
Returns true if this is not a call, or if the call's Target is an Id or a Literal,...
Definition: AbstractNodes.cs:145
Contains global functions of Loyc.Collections that don't belong in any specific class.
Definition: CG.cs:9
This interface is for classes that can convert indexes to SourcePos structures and back.
Definition: IIndexPositionMapper.cs:31
Helper methods for checking argument values that throw exceptions when an argument value is not accep...
Definition: Exceptions.cs:51
VList< T > Push(T item)
Synonym for Add(); adds an item to the front of the list.
Definition: VList.cs:244
override bool Equals(object obj)
Returns true iff the parameter 'obj' is a wrapper around the same object that this object wraps.
Definition: WrapperBase.cs:20
int MaxDepthNodes
Number of nodes that have an overflow list.
Definition: InternalSet.cs:1694
Encapsulates the LeMP engine, a simple LISP-style macro processor, suitable for running LLLPG and oth...
Definition: MacroProcessor.cs:80
IListSource< T > NewItems
Represents either new item(s) that are being added to the collection, or item(s) that are replacing e...
Definition: ListChangeInfo.cs:84
FVList< T > Where(Func< T, bool > filter)
Applies a filter to a list, to exclude zero or more items.
Definition: FVList.cs:539
Definition: EcsParser.cs:75
void EnterWriteLock()
Acquires the lock to protect write access to a shared resource.
Definition: ThreadEx.cs:385
An base class designed for parsers that use LLLPG (Loyc LL(k) Parser Generator) and receive tokens fr...
Definition: BaseParserNoBacktracking.cs:29
Provides the Type() extension method required by Token and the ToString(Token) method to express an E...
Definition: TokenType.cs:163
override bool Equals(object obj)
Returns true iff the parameter 'obj' is a wrapper around the same object that this object wraps.
Definition: ReversedList.cs:26
static readonly Symbol QuestionMark
"'?" Conditional operator. (a?b:c) <=> ԉ۪?(a,b,c) and int? <=> @'of(@'?`, int)
Definition: CodeSymbols.cs:97
static readonly Symbol Sub
"-" Subtraction or unary -
Definition: CodeSymbols.cs:32
virtual bool HasSimpleHead()
Returns true if this is not a call, or if the call's Target is an Id or a Literal.
Definition: LNode.cs:734
Represents a mutable 2D rectangle.
Definition: IRectangle.cs:95
void Done()
LLParserGenerator calls this method to notify the snippet generator that code generation is complete.
virtual void Reset(CharSrc chars, string fileName="", int inputPosition=0, bool newSourceFile=true)
Reinitializes the object. This method is called by the constructor.
Definition: BaseLexer.cs:104
static bool IsInRange(this long num, long lo, long hi)
Returns true if num is between lo and hi.
Definition: GRange.out.cs:61
IEnumerator< Pair< LNode, int > > RunCore(IEnumerator< Pair< LNode, int >> nodes, LNode parent)
Core trivia associaton algorithm.
Definition: AbstractTriviaInjector.cs:233
bool DropRemainingNodes
Gets or sets a value that indicates whether to drop all remaining node after the current one when the...
Definition: IMacroContext.cs:96
bool CompatibilityMode
If there are multiple ways to print a given node, this option indicates that the printer should prefe...
Definition: ILNodePrinterOptions.cs:45
bool SetEquals(Set< T > other)
Definition: Set.cs:167
bool SpaceInsideGroupingParens
Whether to print a space inside grouping parentheses ( ... ).
Definition: Les3PrinterOptions.cs:49
bool IsGlobal
Returns true if this symbol is in the global pool (GSymbol.Pool).
Definition: Symbol.cs:75
int FindLowerBound(ref T item, out bool found)
Definition: BList.cs:363
static void DoesNotThrow(Action code)
Verifies that a delegate does not throw an exception.
Definition: MiniTest.cs:614
static string ToDetailedString(this Exception ex)
Returns a string containing the exception type, message, Data pairs (if any) and stack strace,...
Definition: Extensions.cs:101
T Or(T defaultValue)
Converts Maybe<T> to T, returning a default value if HasValue is false.
static bool IsInRangeExcludeHi(this int num, int lo, int hi)
Returns true if num is between lo and hi, excluding hi but not lo.
Definition: GRange.out.cs:23
bool Toggle(T item)
Toggle's an object's presence in the set.
Definition: MSet.cs:428
IMessageSink?? ErrorSink
Any error that occurs during printing is printed to this object.
Definition: EcsNodePrinter.cs:95
static readonly Symbol Continue
e.g. #continue(); <=> continue;
Definition: CodeSymbols.cs:144
T Value
Any value of type T.
Definition: Holder.cs:24
static bool Verify(bool condition)
Same as Debug.Assert except that the argument is evaluated even in a Release build.
Definition: G.cs:235
The lexical macro processor. Main classes: LeMP.Compiler and LeMP.MacroProcessor.
Definition: IMacroContext.cs:8
bool IsProperSupersetOf(InvertibleSet< T > other)
Definition: InvertibleSet.cs:147
static TokenType Type(this Token t)
Converts t.TypeInt to TokenType.
Definition: TokenType.cs:167
bool IsInteger
Returns true if the type represents only whole numbers.
Definition: Interfaces.cs:128
@ Quotes
Escape single and double quotes
int TotalCount
Returns the number of immutable elements in-use in the entire chain
Definition: VListBlock.cs:307
static void EnsureMutable(WListProtected< T > w, int mutablesNeeded)
Ensures that at least the specified number of items at the front of a FWList or WList are mutable and...
Definition: VListBlock.cs:738
Definition: ArrayOf4.cs:9
void AddUnique(T item)
Adds the specified item to the set, or throws an exception if a matching item is already present.
Definition: MSet.cs:75
Interface for people that want to implement the visitor pattern with LNode. If your visitor does not ...
Definition: LNodeVisitor.cs:19
Precedence Find(OperatorShape shape, object op, bool cacheWordOp=true)
Gets the precedence in LES of a prefix, suffix, or infix operator.
Definition: LesPrecedenceMap.cs:42
T NegativeInfinity
Returns negative infinity, or throws NotSupportedException if T is unsigned.
Definition: Interfaces.cs:105
static int IndexWhere< T >(this IReadOnlyList< T > source, Func< T, bool > pred)
Gets the lowest index at which a condition is true, or -1 if nowhere.
A line/column pair representing a location in a text file. Numbering starts at one for both Line and ...
Definition: ILineColumnFile.cs:11
Base class for implementing a visitor that examines a tree of LLLPG Predicates. The default implement...
Definition: PredVisitor.cs:36
Either< L2, R2 > R2(selectL(_left)) Either< L2, R > R(selectL(_left)) Either< L, R2 > R2(selectR(_right)) Either< L, R > IfLeft(Action< L > actionL)
Runs actionL if Left.HasValue. Equivalent to Left.Then(actionL), but also returns this.
Definition: Either.cs:78
T[] ToArray()
Makes a copy of the list, as an array
Definition: InternalList.cs:316
@ OtherKeyword
e.g. sizeof, struct. Does not include literal keywords (true, false, null)
abstract Maybe< Token > MakeIndentToken(Token indentTrigger, ref Maybe< Token > tokenAfterward, bool newlineAfter)
Returns a token to represent indentation, or null to suppress generating an indent-dedent pair at thi...
static Thread CurrentThread
Gets the currently running thread.
Definition: ThreadEx.cs:217
Contains global functions of Loyc.Utilities that don't belong in any specific class.
Definition: UG.cs:15
LNode GenerateTest(IPGTerminalSet set, LNode laVar)
Generates code to test whether the terminal denoted 'laVar' is in the set.
A read-only interface for objects that act as Loyc trees.
Definition: ILNode.cs:44
This is the new (and recommended) name for LineAndCol. It holds a line number (Line) and a position i...
Definition: SourcePos.cs:107
MMap(IEqualityComparer< K > comparer)
Creates an empty map with the specified key comparer.
Definition: MMap.cs:47
bool Overlaps(IEnumerable< T > other)
Returns true if this set contains at least one item from 'other'.
Definition: Set.cs:144
abstract Maybe< Token > NextToken()
Scans the next token in the character stream and returns the token, or null when the end of the text ...
bool IsSupersetOf(IEnumerable< T > other)
Returns true if all items in the other set are present in this set.
Definition: Set.cs:139
int DoRange(AListOperation mode, IEnumerable< T > e)
Performs the same operation for each item in a series. Equivalent to calling Do(AListOperation,...
Definition: BList.cs:236
void AddRemap(int realLine, int reportLine, string reportFileName=null)
Adds a mapping that starts on the specified real line.
Definition: LineRemapper.cs:102
new bool Not
Inverts the condition if Not==true, so that if the Pred matches, the AndPred does not match,...
Definition: Predicates.cs:866
Definition: TestAlgebraicDataTypes.cs:9
static ? int FirstIndexOf< T >(this IReadOnlyList< T > list, T item)
Determines the index of a specific value.
Definition: IListSource.cs:113
int LineToIndex(int lineNo)
Returns the index in a source file of the beginning of the specified line, where the first line is nu...
Definition: IndexPositionMapper.cs:103
static readonly Symbol Where
"#where" e.g. class Foo<T> where T:class, Foo {} <=> #class(@'of(Foo, [#where(#class,...
Definition: CodeSymbols.cs:178
abstract Token LT(int i)
Returns the token at lookahead i (e.g. Source[InputPosition + i] if the tokens come from a list calle...
Returned by PushCurrent(IParsingService).
Definition: IParsingService.cs:200
Provides operations available on all system numeric types (int, uint, double, etc....
Definition: Interfaces.cs:331
int _immCount
number of immutable elements in our local array, plus a "mutable" flag in bit 30.
Definition: VListBlock.cs:254
Pedantics
This is needed by the EC# node printer, but perhaps no one else.
Definition: EcsValidators.cs:33
void InsertSpace(int index, int count=1)
Inserts empty space starting at the specified index.
abstract int LocalCount
Gets the number of items (slots) used this node only.
Definition: AListNode.cs:161
int NextIndex
Index of next trivia to be injected.
Definition: AbstractTriviaInjector.cs:96
VList< T > Transform(VListTransformer< T > x)
Transforms a list (combines filtering with selection and more).
Definition: VList.cs:629
override VListBlock< T > Add(int localIndex, T item)
Inserts a new item at the "front" of a FVList where localCount is the number of items currently in th...
Definition: VListBlockArray.cs:140
@ NoWrap
Represents a character on which not to wrap, such as a letter.
bool Remove(byte[] key)
Removes the specified key and associated value, returning true if the entry was found and removed.
Definition: CPByteTrie.cs:102
BranchMode
Types of branches in an Alts object (used during parsing only).
Definition: Predicates.cs:749
static void DefineCustomWrapperCreator(GoWrapperCreator from, GoWrapperCreator forceFrom)
Defines a custom wrapper class for the type pair (Interface, T). If you want to install a custom wrap...
Definition: GoInterface.cs:534
FVList< T > WhereSelect(Func< T, Maybe< T >> filter)
Filters and maps a list with a user-defined function.
Definition: FVList.cs:558
int ExceptWith(IEnumerable< T > other, IEqualityComparer< T > thisComparer)
Removes all items from this set that are present in 'other'.
Definition: InternalSet.cs:1389
static readonly Symbol And
"&&" Logical short-circuit 'and' operator
Definition: CodeSymbols.cs:42
TerminalPred(LNode basis, IPGTerminalSet set, bool allowEOF=false)
Initializes the object with the specified set.
Definition: Predicates.cs:963
byte[] _key
the buffer may be larger than the key
Definition: CPTrieMisc.cs:132
static string EscapeCStyle(UString s, EscapeC flags, char quoteType)
Escapes characters in a string using C style.
Definition: PrintHelpers.cs:37
LNodeList SmartSelect(Func< LNode, LNode > map)
Maps a list to another list of the same length.
static V GetOrAdd< K, V >(this IDictionary< K, V > dict, K key, V value)
Adds a key/value pair to the dictionary if the key is not already present, and returns the existing o...
Definition: DictionaryExt.cs:15
int ClearAfter(int minimumMillisec)
Restarts the timer from zero if the specified number of milliseconds have passed, and returns the for...
Definition: SimpleTimer.cs:85
Severity
A linear scale to categorize the importance and seriousness of messages sent to IMessageSink.
Definition: IMessageSink.cs:123
@ PrefixNotation
The node should be printed in prefix notation (even if it is not the natural notation to use)....
Thrown when an assertion fails during a call to a method of Assert.
Definition: MiniTest.cs:193
static bool SortPair< T >(this IList< T > list, int i, int j, Comparison< T > comp)
Sorts two items to ensure that list[i] is less than list[j].
Definition: ListExt.cs:493
Defines noMacro(...) for suppressing macro expansion and import macros your.namespace....
Definition: BuiltinMacros.cs:23
Map< K, V > Xor(MapOrMMap< K, V > other)
Duplicates the current map and then modifies it so that it contains only keys that are present either...
Definition: Map.cs:345
static int LastIndexWhere< T >(this IReadOnlyList< T > source, Func< T, bool > pred)
Gets the highest index at which a condition is true, or -1 if nowhere.
FWList< T > ToFWList()
Returns this list as a FWList, which effectively reverses the order of the elements.
Definition: WList.cs:266
A fairly obscure space-saving hashtable that offers no built-in way to store keys,...
Definition: KeylessHashtable.cs:53
bool Equals(Token other)
Equality depends on TypeInt and Value, but not StartIndex and Length (this is the same equality condi...
Definition: Token.cs:452
override T FGet(int index, int localCount)
Gets an item at distance 'index' from the front (beginning of an FVList)
Definition: VListBlockOfTwo.cs:63
static readonly Symbol Splice
When a macro returns #splice(a, b, c), the argument list (a, b, c) is spliced into the surrounding co...
Definition: CodeSymbols.cs:185
This is the new (and recommended) name for SourcePos. It's named after what it contains: a line numbe...
Definition: SourcePos.cs:117
readonly int Index
Gets the index at which the add, remove, or change operation starts. If the collection is not a list ...
Definition: ListChangeInfo.cs:56
static string SafeSubstring(this string s, int startIndex, int length=int.MaxValue)
A variation on String.Substring() that never throws.
Definition: StringExt.cs:92
Helper class for LinqToLists.
Definition: SelectCollection.out.cs:16
override Maybe< Token > NextToken()
Returns the next (postprocessed) token. This method should set the _current field to the returned val...
Definition: TriviaSaver.cs:28
void Thaw()
Thaws a frozen root node by duplicating it, or creates the root node if the set doesn't have one.
Definition: InternalSet.cs:632
LineColumnFile IndexToLine(int index)
Returns the position in a source file of the specified index.
Definition: IndexPositionMapper.cs:88
BList(Func< T, T, int > compareItems)
Definition: BList.cs:67
void Print(LNode node, StringBuilder target, IMessageSink sink=null, ParsingMode mode=null, ILNodePrinterOptions options=null)
Serializes the specified syntax tree to a StringBuilder in the syntax supported by this object.
Definition: EcsLanguageService.cs:47
BaseParserForList(IList< Token > list, Func< Token, Token > getEofToken, MatchType eof, ISourceFile file, int startIndex=0)
<inheridoc>
Definition: BaseParserForList.cs:224
abstract override LiteralNode WithValue(object value)
Creates a new literal node with a different Value than the current literal node.
@ MatchEveryCall
The macro will be called for every call node (if its namespace is imported).
bool TryAdd(byte[] key, int offset, int length, ref TValue value)
Adds the specified key-value pair only if the specified key is not already present in the trie.
Definition: CPByteTrie.cs:65
Combines ICollection<T> with INotifyListChanging<T, ICollection<T>> and INotifyListChanged<T,...
Definition: Extended interfaces.cs:38
This attribute marks a field in an abstract class as pointing to a wrapped object to which GoInterfac...
Definition: GoInterface.cs:2107
Keeps track of the default message sink (Default); contains a series of helper methods; and contains ...
Definition: MessageSink.out.cs:21
bool OmitUnknownTrivia
Causes trivia that the printer does not recognize (other than comments, spaces and raw text) to be dr...
Definition: ILNodePrinterOptions.cs:29
Definition: CPIntTrie.cs:857
bool HasSpecialName
Returns true if Name is a "special" name (i.e. starts with '#' or '\'' or '.' or any character below ...
Definition: LNode.cs:297
static readonly Symbol PreDec
"--" Unary prefix decrement
Definition: CodeSymbols.cs:38
static void InsertionSort< T >(T[] array, int index, int count, Comparison< T > comp)
Performs an insertion sort.
Definition: InternalList.cs:841
An auto-sizing array is a list structure that allows you to modify the element at any index,...
Definition: INegListSource.cs:91
Represents a write-only indexable list class.
Definition: Sink interfaces.cs:29
override bool Equals(object rhs_)
Returns whether the two list references are the same. Does not compare the contents of the lists.
Definition: FVList.cs:135
@ SkipSpacesInsideNumber
Skip spaces inside the number. Without this flag, spaces make parsing stop.
static readonly Symbol _Bracks
Synonym for Array (‘’[]`)
Definition: CodeSymbols.cs:73
ParserSource(List list, Token eofToken, ISourceFile file, int startIndex=0)
<inheridoc>
Definition: ParserSource.cs:39
int SpacesPerTab
Number of spaces per tab, for the purpose of computing IndentLevel. Initial value: 4
Definition: BaseILexer.cs:56
@ VerbatimStringLiteral
Used for an EC# verbatim string literal like "foo".
static string Localized([Localizable] this string message, params object[] args)
Finds and formats a localization of the given message. If none is found, the original string is forma...
Definition: Localize.cs:337
Definition: Extended interfaces.cs:76
static object Cache(bool value)
Returns G.BoxedTrue or G.BoxedFalse depending on the parameter.
Definition: CG.cs:59
A LiteralHandlerTable that is preinitialized with all standard literal parsers and printers.
Definition: StandardLiteralHandlers.cs:148
void Up()
Returns to the old token list saved by Down.
Definition: BaseParserForList.cs:187
Encapsulates an algorithm that consumes trivia (comments and newlines) from a list and adds it as tri...
Definition: AbstractTriviaInjector.cs:90
object Location
Typically this returns MessageSink.LocationOf(Context).
Definition: ILogMessage.cs:24
An base class designed for parsers that use LLLPG (Loyc LL(k) Parser Generator) and receive tokens fr...
Definition: BaseParserForList.cs:43
bool Find(ref KeyWalker key, ref T value)
Retrieves the value associated with the specified key; does nothing if the key does not exist.
Definition: CPTrie.cs:153
static IEnumerable< Pair< A, B > > ZipLonger< A, B >(this IEnumerable< A > a, IEnumerable< B > b)
Returns a sequence as long as the longer of two sequences. Items from the first and second sequence a...
Definition: ListExt.cs:227
An IEqualityComparer<T> based on reference equality
Definition: ValueComparer.cs:45
static readonly Symbol Base
"#base" e.g. base.X <=> #base.X; base(arg) <=> #base(arg).
Definition: CodeSymbols.cs:180
static void Fail()
Short for Fail("").
Definition: MiniTest.cs:314
LNode ResolveAlias(LNode node)
Returns the node for an alias. If the specified node is not an alias, returns the same node unchanged...
@ Alternate
If this node has two styles in which it can be printed, this selects the second (the less common styl...
Bundles the optional original text of a value with an optional in-memory form of it.
Definition: ILiteralValue.cs:85
virtual void MatchError(bool inverted, IEnumerable< MatchType > expected)
Handles an error that occurs during Match() or MatchExcept()
Definition: BaseParser.cs:396
Important interfaces of newer .NET versions than the version for which Loyc was compiled
Definition: NamespaceDocs.cs:78
void CopyTo(T[] array, int arrayIndex)
Copies the elements of the collection to an Array, starting at a particular array index.
Definition: InternalList.cs:366
bool AllowSwitch
Specified whether this class is allowed to generate C# switch() statements.
Definition: GeneralCodeGenHelper.cs:50
static readonly Symbol ShlAssign
"'<<=" shift-left-by operator
Definition: CodeSymbols.cs:128
@ OldStyle
Use an older or backward-compatible notation.
bool IsEnabled(Severity level)
Returns true if messages of the specified type will actually be printed, or false if Write(type,...
Definition: BasicSinks.cs:195
abstract Symbol Name
Returns the Symbol if IsId. If this node is a call (IsCall) and Target.IsId is true,...
Definition: LNode.cs:291
virtual void BeginRule(Rule rule)
Notifies the snippet generator that code generation is starting for a new rule.
Definition: CodeGenHelperBase.cs:137
static float PutInRange(this float n, float min, float max)
Returns num clamped to the range min and max.
Definition: GRange.out.cs:99
abstract T GetLastItem()
Gets the last item in the last leaf node (needed by B+ trees, but is also called by AListBase<K,...
abstract Pred CodeToTerminalPred(LNode expr, ref string errorMsg)
Creates a terminal predicate from a code expression.
int FindLowerBound(ref K key)
Definition: BDictionary.cs:222
This interface is meant to be implemented by read-only dictionary classes that originally implemented...
Definition: Disambiguation interfaces.cs:102
NoValue.Value is meant to be used as the value of a property that has "no value", meaning no value is...
Definition: NoValue.cs:21
static FVList< T > EnsureImmutable(VListBlock< T > self, int localCount)
Returns an immutable FVList with the specified parameters, modifying blocks if necessary.
Definition: VListBlock.cs:695
UString(string str, int start, int count=int.MaxValue)
Initializes a UString slice.
Definition: UString.cs:75
LNode CreateTryWrapperForRecognizer(Rule rule)
Generates the try-wrapper for a recognizer rule.
ISourceRange Range
Definition: ILNode.cs:54
MaxHeap(TList list, TComparer comparer, Action< T, int > onItemMoved=null)
Initializes the heap wrapper with the list and comparer to use. Both parameters must not be null.
Definition: Heap.cs:64
static Symbol MethodDefinitionKind(LNode n, bool allowDelegate, Pedantics p=Pedantics.Lax)
If the given node has a valid syntax tree for a method definition, a constructor, or (when orDelegate...
Definition: EcsValidators.cs:190
LNode CreateMethod(LNodeList methodBody)
Creates the default method definition to wrap around the body of the rule, which has already been gen...
Definition: Rule.cs:132
void CopyTo(T[] array, int arrayIndex)
Copies the elements of the collection to an Array, starting at a particular array index.
Definition: ReversedList.cs:88
static readonly Symbol ShrAssign
"'>>=" shift-right-by operator
Definition: CodeSymbols.cs:127
FWList< T > SmartWhere(Func< T, bool > keep)
Applies a filter to a list, to exclude zero or more items.
Definition: FWList.cs:148
static NegListSlice< T > Slice< T >(this INegListSource< T > list, int start, int count=int.MaxValue)
Definition: NegListSlice.cs:11
A dictionary class built on top of InternalSet<KeyValuePair<K,V>>.
Definition: MMap.cs:43
Helper class for treating a collection of a derived type as a collection of a base type or interface.
Definition: LCExtensions.cs:111
@ Add
A new item will be added unconditionally, without affecting existing elements, in no particular order...
BaseParserNoBacktracking(Enumerator sequence, Token eofToken, ISourceFile file, int startIndex=0)
Initializes this object to begin parsing the specified tokens.
Definition: BaseParserNoBacktracking.cs:48
bool Remove(ref T item, IEqualityComparer< T > comparer)
Removes an item from the set.
Definition: InternalSet.cs:736
static string ExceptionMessageAndType(this Exception ex)
Returns a string of the form "{ex.Message} ({ex.GetType().Name})".
Definition: Extensions.cs:50
static object Cache(byte o)
Special overload to avoid treating argument as int32 in C#.
Definition: CG.cs:50
static string Join(string separator, IEnumerable value)
Converts a series of values to strings, and concatenates them with a given separator between them.
Definition: StringExt.cs:120
void Run()
Runs the MacroProcessor on all input Files.
Definition: Compiler.cs:544
Common base class that contains code shared between Map<K,V> and MMap<K,V>.
Definition: Map.cs:35
static void That(bool condition, string message)
Calls Fail(message) if condition is false.
Definition: MiniTest.cs:515
void ItemRemoved(T item, AListLeafBase< K, T > parent)
Called when an item is removed from a leaf node.
IMessageSink?? Sink
Called when an error or warning occurs while parsing a grammar or while generating code for a parser....
Definition: LLParserGenerator.cs:137
Contains helper classes and base classes for implementing collections (Loyc.Collections....
Definition: BaseDictionary.cs:7
static PushedCurrent PushCurrent(IParsingService newValue)
Sets the current language service, returning a value suitable for use in a C# using statement,...
Definition: IParsingService.cs:197
static readonly Symbol Mod
"%" Remainder operator
Definition: CodeSymbols.cs:41
The Value property provides easy access to the lexer, parser and printer for Loyc Expression Syntax (...
Definition: Les2LanguageService.cs:17
void Begin(WList< LNode > classBody, ISourceFile sourceFile)
Before the parser generator generates code, it calls this method.
bool AddOrFind(ref KeyValuePair< K, V > pair, bool replaceIfPresent)
For internal use. Adds a pair to the map if the key is not present, retrieves the existing key-value ...
Definition: MMap.cs:205
FWList< T > WhereSelect(Func< T, Maybe< T >> filter)
Filters and maps a list with a user-defined function.
Definition: FWList.cs:167
T NextHigher(T a)
Returns the next representable number higher than a.
void ExitReadLock()
Releases a read lock that was acquired with EnterRead().
Definition: ThreadEx.cs:378
Handles EC# processor directives.
Definition: EcsPreprocessor.cs:50
override void Visit(Alts alts)
Visit(Alts) is the most important method in this class. It generates all prediction code,...
Definition: GenerateCodeVisitor.cs:143
void Resize(int newSize)
Resizes the list to the specified size.
Definition: WList.cs:288
int SymmetricExceptWith(IEnumerable< T > other, IEqualityComparer< T > comparer, bool xorDuplicates=true)
Modifies the current set to contain only elements that were present either in this set or in the othe...
Definition: InternalSet.cs:1442
IPGTerminalSet WithEOF(bool wantEOF=true)
Adds or removes EOF from the set. If the set doesn't change, this method may return this.
Definition: GeneralCodeGenHelper.cs:309
@ Keep
Include the original item in the output list
void SetAt(int index, T value)
Sets an item in a FWList or WList at the specified index.
Definition: WListBase.cs:131
bool Overlaps(IEnumerable< T > other, IEqualityComparer< T > thisComparer)
Returns true if this set contains at least one item from 'other'.
Definition: InternalSet.cs:1521
Extension methods and helper methods for IList<T>.
Definition: ArraySlice.cs:10
static bool IsInRange(this ulong num, ulong lo, ulong hi)
Returns true if num is between lo and hi.
Definition: GRange.out.cs:78
void CopyTo(T[] array, int arrayIndex)
Copies the elements of the collection to an Array, starting at a particular array index.
Definition: ListAsListSource.cs:109
static FVList< T > AddRange(VListBlock< T > self, int localCount, FVList< T > front, FVList< T > back)
Adds a range of items to a FVList where localCount is the number of items in the FVList's first block...
Definition: VListBlock.cs:550
Definition: InternalList.cs:865
BaseParserForList(List list, Func< Token, Token > getEofToken, MatchType eof, ISourceFile file, int startIndex=0)
Initializes this object to begin parsing the specified tokens.
Definition: BaseParserForList.cs:78
Provides the multiplication operation and the multiplicative identity, one.
Definition: Interfaces.cs:246
abstract uint GetImmutableCount(bool excludeSparse)
Diagnostic method. See AListBase<K,T>.GetImmutableCount().
static new readonly Symbol TriviaCsRawText
"%C#RawText" - C#RawText("stuff") - Raw text that is only printed by the C# printer (not printers for...
Definition: EcsCodeSymbols.cs:28
static ? int FirstIndexOf(this StringBuilder sb, char value, int startIndex=0)
Gets the index of a character in a StringBuilder
Definition: StringBuilderExt.cs:73
FVList< T > ToFVList()
Returns this list as a FVList, which effectively reverses the order of the elements.
Definition: VList.cs:256
SourceRange Range(ISourceFile sf)
Gets the SourceRange of a token, under the assumption that the token came from the specified source f...
Definition: Token.cs:381
static LNodeList WithTrailingTrivia(this LNodeList attrs, LNodeList trivia)
Removes all existing trailing trivia from an attribute list and adds a new list of trailing trivia.
Definition: LNodeExt.cs:50
bool PreserveComments
Whether to preserve comments and newlines by attaching trivia attributes to the output....
Definition: IParsingOptions.cs:20
static readonly Symbol IS
Backquoted suffixes in LES3 use this: xbytes <=> 'IS(x, bytes)
Definition: CodeSymbols.cs:117
int Min
Returns the minimum valid index.
Definition: NegList.cs:74
ICollection< Symbol > OpenMacroNamespaces
Gets the list of namespaces that are being searched for macros in the current scope....
Definition: IMacroContext.cs:147
@ Passive
It is normal for this macro not to change the code, so a warning should not be printed when the macro...
Provides operations available on all signed numeric types (int, double, etc.); see also IUIntMath<T>,...
Definition: Interfaces.cs:345
static readonly Symbol Not
"!" Logical 'not' operator
Definition: CodeSymbols.cs:57
static string ToString(Token t, ICharSource sourceCode)
Expresses an EC# token as a string.
Definition: TokenType.cs:178
static readonly Symbol PreInc
"++" Unary prefix increment
Definition: CodeSymbols.cs:37
BDictionary(Func< K, K, int > compareKeys, int maxNodeSize)
Definition: BDictionary.cs:67
LNode VisitInput(LNode stmt, IMessageSink sink)
In case the IPGCodeGenHelper is interested, the LLLPG macro calls this method on each statement in th...
IndentTokenGenerator(ILexer< Token > lexer)
Initializes the indent detector.
Definition: IndentTokenGenerator.cs:62
bool CanParse(Precedence rightOp)
For use in parsers. Returns true if 'rightOp', an operator on the right, has higher precedence than t...
Definition: Precedence.cs:305
static ILexer< Token > TokenizeFile(this IParsingService parser, string fileName, IMessageSink msgs=null)
Opens the specified file and tokenizes it.
Definition: IParsingService.cs:311
Extension methods for IPGTerminalSet.
Definition: IPGTerminalSet.cs:38
Token LT0
Next token to parse (cached; is set to LT(0) whenever InputPosition is changed).
Definition: BaseParser.cs:75
IEnumerable< T > InnerList
Gets the list upon which this range is based.
Definition: IRanges.cs:307
static readonly Symbol Alias
Definition: CodeSymbols.cs:166
Helpers methods for unit tests, especially used by Loyc collection classes but sometimes useful in ot...
Definition: TestHelpers.cs:11
static string DataList(this Exception ex, string linePrefix, string keyValueSeparator, string newLine)
Converts Exception.Data to a string, separating each key from each value with keyValueSeparator,...
Definition: Extensions.cs:131
object Context
An object associated with the event being logged (possibly huge).
Definition: ILogMessage.cs:16
abstract LiteralNode WithValue(object value)
Creates a new literal node with a different Value than the current literal node.
override int AdjustWListIndex(int index, int size)
This method implements the difference between FWList and WList: In FWList it returns index,...
Definition: FWList.cs:33
BList(Func< T, T, int > compareItems, int maxLeafSize, int maxInnerSize)
Initializes an empty BList.
Definition: BList.cs:99
void SetListInitializer(LNode varDecl)
Sets ListType and/or ListInitializer based on an expression. A statement like Type x = expr sets List...
Definition: CodeGenHelperBase.cs:75
virtual void MatchError(bool inverted, IList< int > ranges)
Handles an error that occurs during Match(), MatchExcept(), MatchRange() or MatchExceptRange()
Definition: BaseLexer.cs:628
string Name
Gets the name of the Symbol.
Definition: Symbol.cs:69
static T With< T >(this T obj, Action< T > action)
Calls action(obj), then returns the same object.
Definition: G.cs:109
Definition: InternalSet.cs:1046
void Detach(AListBase< K, T > list, AListNode< K, T > root)
Called when the observer is being detached from an AList. Detach(), unlike Attach(),...
Use this interface for floating-point, fixed-point, and rational types. Rational types support recipr...
Definition: Interfaces.cs:370
abstract LNode Clone()
Creates a copy of the node. Since nodes are immutable, there is little reason for an end-user to call...
int CurrentIndex
Index of the last item that was enumerated. If has been enumerated yet, this will typically be one be...
Definition: AListBase.cs:691
Standard extension methods for IMacroContext.
Definition: IMacroContext.cs:151
bool? Attach(AListBase< K, T > list)
Called when the observer is being attached to an AList.
This interface for converting literals to text is implemented by LiteralHandlerTable.
Definition: ILiteralPrinter.cs:10
An exception thrown by methods or properties that require a non-empty sequence but were provided with...
Definition: Exceptions.cs:121
bool TryAdd(int key, ref TValue value)
Adds the specified key-value pair only if the specified key is not already present in the trie.
Definition: CPIntTrie.cs:306
new int LineStartAt
Definition: LexerSource.cs:97
ReplaceOpt
Definition: LNode.cs:974
override T Front(int localCount)
Returns the "front" item in a FVList/FWList associated with this block (or back item of a VList) wher...
Definition: VListBlockOfTwo.cs:94
bool DropNonDeclarationAttributes
Suppresses printing of attributes inside methods and inside subexpressions, except on declaration or ...
Definition: EcsNodePrinter.cs:1325
bool Set(ref KeyWalker key, ref T value, CPMode mode)
Associates the specified value with the specified key.
Definition: CPTrie.cs:179
abstract VListBlock< T > Add(int localCount, T item)
Inserts a new item at the "front" of a FVList where localCount is the number of items currently in th...
override Pred Clone()
Deep-clones a predicate tree. Terminal sets and Nodes referenced by the tree are not cloned; the clon...
Definition: Predicates.cs:508
ILineColumnFile IndexToLine(int index)
Returns the position in a source file of the specified index.
override LNode MakeTriviaAttribute(Token t)
Called to transform a trivia token into a trivia attribute.
Definition: EcsTriviaInjector.cs:68
@ Minimal
Only \r, , \0 and backslash are escaped.
virtual LNode DoneAttaching(LNode node, LNode parent, int indexInParent)
This method is called after a node has been processed and any applicable trivia was attached.
Definition: AbstractTriviaInjector.cs:186
void SetAtDff(int distanceFromFront, T item)
Sets an item WITHOUT doing a range or mutability check
Definition: WListBase.cs:300
A sparse A-List that implements ISparseList<T>.
Definition: SparseAList.cs:31
override Maybe< Token > NextToken()
Scans the next token and returns information about it.
Definition: Les3Lexer.out.cs:875
MMap< K, V > Union(MapOrMMap< K, V > other, bool replaceWithValuesFromOther)
Definition: MMap.cs:281
bool MayContain(Symbol item)
Returns whether the bloom filter indicates that this set may contain the specified item....
Definition: SymbolSet.cs:47
Abstract class that helps you implement wrappers by automatically forwarding calls to Equals(),...
Definition: WrapperBase.cs:10
virtual LNode CreateRuleMethod(Rule rule, LNodeList methodBody)
Generates the method for a rule, given the method's contents.
Definition: CodeGenHelperBase.cs:388
static LNode MergeLists(LNode node1, LNode node2, Symbol listName)
Some CallNodes are used to represent lists. This method merges two nodes, forming or appending a list...
Definition: LNode.cs:777
Compact patricia tree class that stores keys as byte arrays. This class is intended to be use as a ba...
Definition: CPTrie.cs:37
int SymmetricExceptWith(IEnumerable< T > other)
Modifies the current set to contain only elements that were present either in this set or in the othe...
Definition: MSet.cs:241
void InsertSpace(int index, int count=1)
Inserts empty space starting at the specified index.
Definition: SparseAList.cs:257
byte _childCount
Number of children, if this is an inner node.
Definition: AListNode.cs:276
override int Count
Returns the number of dictionary entries. This value may be greater than the number of elements that ...
Definition: WeakValueDictionary.cs:61
static IEnumerable< C > ZipLonger< A, B, C >(this IEnumerable< A > a, IEnumerable< B > b, A defaultA, B defaultB, Func< A, B, C > resultSelector)
An alternate version of ZipLonger<A, B>(IEnumerable<A>, IEnumerable<B>, A, B) in which a user-defined...
Definition: ListExt.cs:261
virtual void Reset(List list, Func< Token, Token > getEofToken, MatchType eof, ISourceFile file, int startIndex=0)
Reinitializes the object. This method is called by the constructor.
Definition: BaseParserForList.cs:93
Extension methods that add some functionality of string to StringBuilder.
Definition: StringBuilderExt.cs:10
static ? int FirstIndexOf(this StringBuilder sb, UString searchStr, int startIndex=0, bool ignoreCase=false)
Gets the index of a substring in a StringBuilder
Definition: StringBuilderExt.cs:88
int IndexOf(T item)
Finds the lowest index of an item that is equal to or greater than the specified item.
Definition: BList.cs:310
void EndRemap(int realLine)
Corresponds to #line default in C#.
Definition: LineRemapper.cs:107
abstract FVList< T > SubList(int localIndex)
Returns a list in which this[localIndex-1] is the first item. Nonpositive indexes are allowed and ref...
bool CanPrint(Symbol typeMarker)
Finds out whether there is a printer for the given type marker. Never throws.
Contains tests for the LeMP.MacroProcessor and for standard LeMP macros.
Definition: MacroProcessorTests.cs:15
ThreadLocalVariable(T initialValue, bool autoFallback=false)
Constructs a ThreadLocalVariable.
Definition: ThreadEx.cs:486
virtual LNode ApiCall(Symbol apiName, params LNode[] args)
Returns an LNode representing a call to the specified LLLPG API. For example, if the user used a "inp...
Definition: CodeGenHelperBase.cs:467
A preprocessor usually inserted between the lexer and parser that converts a token list into a token ...
Definition: TokensToTree.cs:24
@ PriorityOverride
High priority. If this macro is ambiguous with another macro that doesn't have this flag nor Override...
void Reset()
Called when a new, separate printing operation begins.
static readonly NullMessageSink Null
The message sink that discards all messages.
Definition: MessageSink.out.cs:315
An auto-sizing array is a list structure that allows you to modify the element at any index,...
Definition: Other interfaces.cs:132
Bijection< K2, K1 > Inverse
Returns the inverse dictionary. Note: this.Inverse.Inverse == this.
Definition: Bijection.cs:90
IListSource< LNode > Parse(ICharSource text, string fileName, IMessageSink msgs, IParsingOptions options)
Parses a source file into one or more Loyc trees.
Definition: Les3LanguageService.cs:61
LNodeKind
The three kinds of nodes in a Loyc tree
Definition: ILNode.cs:10
A base class for user-defined dictionaries that want to implement both IDictionary(K,...
Definition: BaseDictionary.cs:14
static LNode AsLNode(this LNodeList list, Symbol listIdentifier)
Converts a list of LNodes to a single LNode by using the list as the argument list in a call to the s...
Definition: LNodeExt.cs:178
static IReadOnlyDictionary< string, IParsingService > RegisteredLanguages
Dictionary of registered parsing services, keyed by file extension (without leading dots)....
Definition: IParsingService.cs:133
int FindLowerBound(K key)
Definition: BDictionary.cs:197
Represents a write-only collection: you can modify it, but you cannot learn what it contains.
Definition: Sink interfaces.cs:15
IEnumerable< LNode > Start(Holder< TokenType > separator)
Top-level rule: expects a sequence of statements followed by EOF
Definition: Les2Parser.cs:110
new UString Slice(int startIndex, int length)
Returns a substring from the character source. If some of the requested characters are past the end o...
Definition: StreamCharSource.cs:95
virtual void Freeze()
Prevents further changes to the list.
Definition: AListBase.cs:1028
static char LastOrDefault(this StringBuilder str, char @default='\0')
Returns the last character of the string, or a default character if the string is empty.
Definition: StringBuilderExt.cs:27
T NextLowerItem(ref int? index)
Decreases index by at least one to reach the next index that is not classified as empty space,...
Definition: SparseAList.cs:302
InternalList< T > Clone()
Makes a copy of the list with the same capacity
Definition: InternalList.cs:306
This class incrementally recomputes the sum of an AList<T> (or its variants - BList,...
Definition: AListStatisticTracker.cs:218
An sorted in-memory list that is efficient for all operations and offers indexed access to its list.
Definition: BList.cs:51
@ Handled
Indicates that some part of a compiler, or a macro, has seen the node and done something with it.
T Depth
Gets the depth of a rectangle (the difference between Z coordinates).
Definition: IRectangle3.cs:13
static ReversedListSource< T > Reverse< T >(this IListSource< T > c)
Returns a reversed view of a read-only list.
Definition: LinqToLists.out.cs:248
@ UnicodeNonCharacters
Escape non-character unicode code points such as the Byte Order Mark and unpaired surrogate pair char...
BList< T > Clone()
Definition: BList.cs:262
override FVList< T > SubList(int localIndex)
Returns a list in which this[localIndex-1] is the first item. Nonpositive indexes are allowed and ref...
Definition: VListBlockOfTwo.cs:118
void CallListChanging(AListBase< K, T > tree, ListChangeInfo< T > listChangeInfo)
Allows derived classes of AListNode to fire the AListBase.ListChanging event properly.
Definition: AListNode.cs:283
A decorator (wrapper) for IMessageSink that filters out some messages if their Severity is too low,...
Definition: WrapperSinks.cs:13
static StringBuilder PrintToHtml(IEnumerable< ILNode > nodes, StringBuilder output=null, bool addPreCode=true, IMessageSink sink=null, ILNodePrinterOptions options=null)
Prints an LNode as LESv3 with HTML syntax highlighting elements.
Definition: Les3PrettyPrinter.cs:188
abstract int PriorCount
Returns the number of immutable items in all previous blocks.
Definition: VListBlock.cs:266
static void InsertionSort< T >(this IList< T > array, int index, int count, Comparison< T > comp)
Performs an insertion sort.
Definition: ListExt.cs:479
Extension methods for ICollection<T>.
Definition: ICollectionExt.cs:10
static FVList< T > AddRange(VListBlock< T > self, int localCount, IReadOnlyList< T > items, bool isRVList)
Adds a list of items to an immutable FVList.
Definition: VListBlock.cs:517
ulong MaxInt
Returns the maximum integer that this type can represent.
Definition: Interfaces.cs:143
static string MakeValidFileName(string text, char? replacement='_', bool fancy=true)
Replaces characters in text that are not allowed in file names with the specified replacement charact...
Definition: G.cs:209
void Add(KeyValuePair< K, V > item)
Definition: MMap.cs:94
static readonly Symbol Typeof
Definition: CodeSymbols.cs:106
static readonly Symbol Enum
e.g. #enum(Foo, #(byte), { }); <=> enum Foo : byte { }
Definition: CodeSymbols.cs:165
bool IsEnabled(Severity level)
Always returns true.
Definition: BasicSinks.cs:94
bool Equals(TokenTree other)
Compares the elements of the token tree for equality.
Definition: TokenTree.cs:96
void Add(T item)
An alias for PushLast().
Definition: InternalDList.cs:675
static new readonly Symbol Await
await(x); <=> await x; (TENTATIVE: should this be changed to #await?)
Definition: EcsCodeSymbols.cs:21
Base class of all nodes that represent calls such as f(x), operator calls such as x + y,...
Definition: AbstractNodes.cs:83
This priority queue wrapper type is returned from the AsMaxHeap() extension method.
Definition: Heap.cs:293
virtual bool IsFrozen
Returns true if the node is immutable, and false if any part of it can be edited. Currently,...
Definition: LNode.cs:261
static LNode InParens(this LNode node, ISourceFile file, int startIndex, int endIndex)
Returns the same node with a parentheses attribute added.
Definition: LNodeExt.cs:324
static readonly Symbol UsingStmt
e.g. #using(expr, {...}); <=> using(expr) {...} (note: use #import or CodeSymbols....
Definition: CodeSymbols.cs:138
int IndexOf(T item)
Searches for the specified object and returns the zero-based index of the first occurrence (lowest in...
Definition: VList.cs:321
static IEnumerable< C > ZipLeft< A, B, C >(this IEnumerable< A > a, IEnumerable< B > b, B defaultB, Func< A, B, C > resultSelector)
An alternate version of ZipLeft<A, B>(IEnumerable<A>, IEnumerable<B>, B) in which a user-defined func...
Definition: ListExt.cs:217
static readonly Symbol Throw
e.g. #throw(expr); <=> throw expr;
Definition: CodeSymbols.cs:148
bool SetEquals(MSet< T > other)
Definition: Set.cs:169
static readonly Symbol While
e.g. #while(condition,{...}); <=> while(condition) {...}
Definition: CodeSymbols.cs:137
override string Example(IPGTerminalSet set_)
Returns an example of an item in the set. If the example is a character, it should be surrounded by s...
Definition: GeneralCodeGenHelper.cs:112
Maybe< V > GetAndRemove(K key)
Gets the value associated with the specified key, then removes the pair with that key from the dictio...
A general-purpose interface for a class that accepts formatted messages with context information.
Definition: IMessageSink.cs:80
NodeStyle Style
Definition: ILNode.cs:56
Interface for a collection that can return IBinumerator<T>s pointing to the beginning and end of the ...
Definition: New enumerators.cs:70
This is a tag which indicates that objects of this type are unique; specifically, any two different o...
Definition: MiscInterfaces.cs:36
WList< T > SmartSelect(Func< T, T > map)
Maps a list to another list of the same length.
Definition: WList.cs:184
This class only exists to work around a limitation of the C# language: "cannot change access modifier...
Definition: LexerSource.cs:164
Represents a zero-width assertion: either user-defined code to check a condition, or a predicate that...
Definition: Predicates.cs:854
static int IndexOf< T >(this IEnumerable< T > list, T item)
Determines the index of a specific value.
Definition: EnumerableExt.cs:350
DList< T > AsDList()
Returns a DList<T> wrapped around this list.
Definition: InternalDList.cs:950
IMessageSink?? ErrorSink
Gets or sets the object to which error messages are sent. The default object is LogExceptionErrorSink...
Definition: BaseLexer.cs:148
static string EliminateNamedArgs(string format, params object[] args)
Called by Format to replace named placeholders with numeric placeholders in format strings.
Definition: StringExt.cs:201
Adapter: a random-access range for a slice of an IReadOnlyList<T>.
Definition: ROLSlice.cs:22
static FVList< T > InsertRange(VListBlock< T > self, int localCount, IReadOnlyList< T > items, int distanceFromFront, bool isRVList)
Inserts a list of items in the middle of a FVList, where localCount is the number of items in the FVL...
Definition: VListBlock.cs:431
A set of relatively universal parsing options that IParsingServices should understand.
Definition: IParsingOptions.cs:12
Searches for test methods and runs them, printing the name of each test to the console followed by er...
Definition: RunTests.cs:21
T PopLast(out bool fail)
Removes the last item from the range and returns it.
virtual SourceRange Range
Returns the location and range in source code of this node.
Definition: LNode.cs:207
override IPGTerminalSet Optimize(IPGTerminalSet set, IPGTerminalSet dontcare)
Simplifies the specified set, if possible, so that GenerateTest() can generate simpler code for an if...
Definition: IntStreamCodeGenHelper.cs:83
MaxHeap< T, TList, TComparer > Heapify()
Rearranges items to ensure that the underlying list has the heap property. Takes O(Count) time.
Definition: Heap.cs:73
int LineToIndex(int lineNo)
Returns the index in a source file of the beginning of the specified line, where the first line is nu...
virtual object IndexToMsgContext(Token token)
Gets the context for use in error messages, which by convention is a SourceRange.
Definition: IndentTokenGenerator.cs:150
Definition: Les3LanguageService.cs:10
VList< T > WhereSelect(Func< T, Maybe< T >> filter)
Filters and maps a list with a user-defined function.
Definition: VList.cs:565
ListChangeInfo(NotifyCollectionChangedAction action, int index, int sizeChange, IListSource< T > newItems)
Initializes the members of ListChangeInfo<T>.
Definition: ListChangeInfo.cs:23
UString ToUpper()
Converts the string to uppercase using the 'invariant' culture.
Definition: UString.cs:489
override LNode GenerateMatchExpr(IPGTerminalSet set_, bool savingResult, bool recognizerMode)
Generate code to match a set, e.g. MatchRange('a', 'z'); or MatchExcept(' ', '\r'); }....
Definition: GeneralCodeGenHelper.cs:185
bool IsSet(int index)
Determines whether a value exists at the specified index.
Definition: SparseAList.cs:274
static Pair< LNodeList, LNodeList > GetArgsAndBody(this IMacroContext ctx, bool orRemainingNodes)
Splits the current node into a pair of "argument" and "body" lists, potentially treating ctx....
Definition: IMacroContext.cs:195
static void SetRange< K, V >(this IDictionary< K, V > dict, IEnumerable< KeyValuePair< K, V >> list)
Adds data to a dictionary (dict[key] = value for all pairs in a sequence.)
Definition: DictionaryExt.cs:147
virtual void LLInsert(int i, AListNode< K, T > child, uint indexAdjustment)
Inserts a child node into _children at index i (resizing _children if necessary), increments _childCo...
Definition: AListInnerBase.cs:314
uchar DecodeAt(int index)
Returns the UCS code point that starts at the specified index.
Definition: UString.cs:243
bool Contains(T item)
Returns true if the list contains the specified item, and false if not.
Definition: BList.cs:324
int Length
Length of the token in the source file, or 0 for a synthetic or implied token.
Definition: Token.cs:299
You'd think the .NET framework would have a built-in method–even a CIL opcode–to bitwise-compare two ...
Definition: ValueComparer.cs:24
IPGTerminalSet UnionCore(IPGTerminalSet other)
Merges two sets.
LNode GetMethodSignature()
Returns Basis if it's a method signature; otherwise constructs a default signature.
Definition: Rule.cs:105
abstract MatchType EofInt()
Returns the value used for EOF (normally 0)
static IListSource< LNode > Parse(this IParsingService parser, Stream stream, string fileName, ParsingMode inputType=null, IMessageSink msgs=null, bool preserveComments=true)
Parses a Stream.
Definition: IParsingService.cs:286
virtual int IndexOf(T item)
Finds an index of an item in the list.
Definition: AList.cs:769
Helper struct: enumerates through a forward range (IFRange<T>), calling the range methods through R i...
Definition: RangeEnumerator.cs:12
static LNode LLLPG_lexer(LNode node, IMacroContext context)
Helper macro that translates lexer in LLLPG(lexer, {...}) into a IntStreamCodeGenHelper object.
Definition: Macros.cs:76
bool TryAdd(byte[] key, TValue value)
Adds the specified key-value pair only if the specified key is not already present in the trie.
Definition: CPByteTrie.cs:47
Encapsulates LLLPG, the Loyc LL Parser Generator, which generates LL(k) recursive-descent parsers.
Definition: AnalysisVisitors.cs:17
static Either< L, R > From< L2, R2 >(Either< L2, R2 > x)
Does an upcast, e.g. Either{string,ArgumentException} to Either{object,Exception}....
int AddRange(IEnumerable< KeyValuePair< K, V >> data, bool replaceIfPresent=true)
Merges the contents of the specified sequence into this map.
Definition: MMap.cs:160
Provides read-only access to the values of a CPTrie.
Definition: CPTrie.cs:257
Contains extension methods for ICollection<T> and IList<T> that are possibly ambiguous when included ...
Definition: NamespaceDocs.cs:73
@ BaseStyleMask
If s is a NodeStyle, (s & NodeStyle.BaseStyleMask) is the base style (Default, Operator,...
int TotalCount
Returns the number of Symbols created in this pool.
Definition: Symbol.cs:374
void NodeAdded(AListNode< K, T > child, AListInnerBase< K, T > parent)
Called when a child node is added to an inner node.
Definition: AListIndexer.cs:110
static int Unregister(IParsingService service, IEnumerable< string > fileExtensions=null)
Unregisters a language service.
Definition: IParsingService.cs:160
bool SetEquals(ISet< T > other, int myExactCount)
Returns true if this set and the other set have the same items.
Definition: InternalSet.cs:1621
Definition: NegList.cs:16
@ Drop
Do not include the item in the output list
bool Remove(T item)
Removes a single instance of the specified item.
Definition: BList.cs:148
Identifies a method that contains a unit test, or that returns other tests or test fixtures.
Definition: MiniTest.cs:83
Adapter: a random-access range for a slice of an IListSource<T>.
Definition: Slice.cs:34
bool IsProperSubsetOf(IEnumerable< T > other)
Definition: MSet.cs:276
override string ToString()
Returns ToString() of the wrapped list.
Definition: NegList.cs:135
A set of relatively universal printing options that LNodePrinters should understand.
Definition: ILNodePrinterOptions.cs:11
static readonly Symbol InitializerAssignment
ԉ۪[]=`(0, 1, x) <=> [0,1]=x
Definition: CodeSymbols.cs:85
static Func< Token, ICharSource, string >?? ToStringStrategy
Gets or sets the strategy used by ToString.
Definition: Token.cs:374
@ UnicodePrivateUse
Escape unicode private-use code points.
static int[] RangeArray(int count)
Returns an array of Length count containing the numbers 0 through count-1.
Definition: ListExt.cs:268
byte UserByte
An additional byte that the derived class can optionally use.
Definition: WListBase.cs:69
static readonly Symbol Shl
"<<" Left-shift operator
Definition: CodeSymbols.cs:56
virtual LNode VisitInput(LNode stmt, IMessageSink sink)
In case the IPGCodeGenHelper is interested, the LLLPG macro calls this method on each statement in th...
Definition: CodeGenHelperBase.cs:106
Symbol GetTypeMarker(SourceRange range)
LNode.TypeMarker returns whatever this returns.
static void UnescapeQuotedString(ref UString sourceText, Action< int, string > onError, StringBuilder sb, UString indentation=default(UString), bool les3TQIndents=false)
Parses a normal or triple-quoted string that still includes the quotes (see documentation of the firs...
Definition: Les2Lexer.cs:182
Encapsulates the code for printing an LNode to EC# source code.
Definition: EcsNodePrinter.cs:81
FVList< T > Tail
Returns a list without the first item. If the list is empty, an empty list is retured.
Definition: FVList.cs:98
static IEnumerable< Pair< T, T > > AdjacentPairsCircular< T >(this IEnumerable< T > list)
Returns all adjacent pairs, treating the first and last pairs as adjacent (e.g. for the list {1,...
Definition: EnumerableExt.cs:404
bool CanPrint(Type type, bool searchBases=true)
Returns true if there is a printer function for the given type. Never throws.
Definition: LiteralHandlerTable.cs:99
Adapter: a read-only wrapper that implements ICollection(T) and IReadOnlyCollection(T),...
Definition: CollectionAsSource.cs:27
static readonly Symbol Async
[#async] Task Foo(); <=> async Task Foo();
Definition: CodeSymbols.cs:78
Defines prelude macros, which are predefined macros that normally do not have to be explicitly import...
Definition: BuiltinMacros.cs:16
static readonly Symbol Array
Used for list/array literals. Not used for attributes.
Definition: CodeSymbols.cs:72
This interface exists to work around a limitation of C#; see IRectangle<T>.
Definition: IRectangle.cs:81
VList< T > ToVList()
Returns this list as a VList, which effectively reverses the order of the elements.
Definition: FVList.cs:227
void Move(int from, int to)
Slides the array entry at [from] forward or backward in the list, until it reaches [to].
Definition: InternalList.cs:344
void CompleteInputOutputOptions()
Fills in all fields of Files that are still null, based on the command-line options....
Definition: Compiler.cs:468
int CountOnes(T a)
Returns the number of '1' bits in 'a'.
IAListTreeObserver< K, T > GetObserver(AListBase< K, T > tree)
Allows derived classes of AListNode to access AListBase._observer.
Definition: AListNode.cs:279
bool IsProperSubsetOf(Set< T > other)
Definition: MSet.cs:270
static readonly Symbol ConcatAssign
"'~=" concatenate-and-set operator
Definition: CodeSymbols.cs:126
static bool IsExtendedOperatorToken(UString name)
Returns true if the given Symbol can ever be used as an "extended" binary operator in LESv3.
Definition: LesPrecedenceMap.cs:244
bool IsSubsetOf(IEnumerable< T > other)
Returns true if all items in this set are present in the other set.
Definition: Set.cs:133
override LNode LA(int k)
Generates code to read LA(k).
Definition: GeneralCodeGenHelper.cs:230
IMessageSink ErrorSink
Event handler for errors.
Definition: ILexer.cs:22
Represents a write-only dictionary class.
Definition: Sink interfaces.cs:57
LexerSource(CharSrc source, string fileName="", int inputPosition=0, bool newSourceFile=true)
Initializes LexerSource.
Definition: LexerSource.cs:56
static bool Equals(ILNode a, ILNode b, CompareMode mode=CompareMode.Normal)
Definition: LNode.cs:611
string Description
Descriptive text for this fixture
Definition: MiniTest.cs:33
LNode CallTryRecognizer(RuleRef rref, int lookahead)
Generates a call to the Try_Scan_*() function that wraps around a Scan_*() recognizer....
int Id
Returns a numeric ID for the Symbol.
Definition: Symbol.cs:82
LNode LA(int k)
Generates code to read LA(k).
bool? Attach(AListBase< K, T > list)
Called when the observer is being attached to an AList.
virtual LNode GenerateTest(IPGTerminalSet set, LNode laVar)
Generates code to test whether the terminal denoted 'laVar' is in the set.
Definition: CodeGenHelperBase.cs:150
bool PredUsesLA
Returns true if Pred contains $LA.
Definition: Predicates.cs:874
static int HexDigitValue(char c)
Gets the integer value for the specified hex digit, or -1 if the character is not a hex digit.
Definition: ParseHelpers.cs:44
int IntersectWith(Set< T > other)
Removes all items from this set that are not present in 'other'.
Definition: MSet.cs:232
AbstractTriviaInjector(IListSource< Trivia > sortedTrivia)
Initializes the SortedTrivia property.
Definition: AbstractTriviaInjector.cs:99
virtual LNode Select(Func< LNode, Maybe< LNode >> selector, ReplaceOpt options=ReplaceOpt.ProcessAttrs)
Transforms the Target, parameters, and optionally the attributes of an LNode, returning another LNode...
Definition: LNode.cs:961
override bool SupportDotIndents()
The LES and EC# languages support "dot indents", which are lines that start with a dot (....
Definition: Les3.cs:61
Symbol GetById(int id)
Gets a symbol by its ID, or null if there is no such symbol.
Definition: Symbol.cs:357
static readonly Symbol Mul
"*" Multiplication (or dereference)
Definition: CodeSymbols.cs:29
LNode ListType
Gets or sets the type of lists created with the +: operator (default: List<T>). The identifier "T" sh...
Definition: CodeGenHelperBase.cs:65
override? char ExampleChar(IPGTerminalSet set_)
Returns an example of a character in the set, or null if this is not a set of characters or if EOF is...
Definition: IntStreamCodeGenHelper.cs:106
virtual void Start(object parameter)
Causes the operating system to change the state of the current instance to System....
Definition: ThreadEx.cs:107
Common base class of AList<T> and SparseAList<T>. Most of the functionality of the two types is ident...
Definition: AList.cs:633
int Length
Current length of the output string
Definition: PrinterState.cs:113
IReadOnlyDictionary< object, Func< ILNode, StringBuilder, Either< Symbol, LogMessage > > > Printers
A table of printers indexed by Type or by type marker Symbol. The AddPrinter methods are used to add ...
Definition: LiteralHandlerTable.cs:32
Provides the value of "zero" for type T.
Definition: Interfaces.cs:79
static ? int FinalIndexWhere< T >(this IList< T > list, Func< T, bool > pred)
Gets the highest index at which a condition is true, or null if nowhere.
LNode LAType()
Returns the data type of LA(k)
bool Contains(T item)
Returns true if and only if the collection contains the specified item.
@ AddIfNotPresent
Add a new item if the key doesn't match an existing pair, or do nothing if it does.
int Length
Gets the length of the string in code units (which may be greater than the number of actual character...
Definition: UString.cs:120
static readonly Symbol GE
">=" Greater-than-or-equal-to operator
Definition: CodeSymbols.cs:50
This interface is intended to be implemented by editable collection classes that are not indexable li...
Definition: Disambiguation interfaces.cs:33
new int InputPosition
Cumulative index of the next token to be parsed.
Definition: BaseParserNoBacktracking.cs:111
NodeStyle Style
Indicates the preferred style to use when printing the node to a text string.
Definition: LNode.cs:232
An sorted dictionary that is efficient for all operations and offers indexed access to its list of ke...
Definition: BDictionary.cs:42
void Sort()
Uses a specialized "tree quicksort" algorithm to sort this list using Comparer<T>....
Definition: AList.cs:355
BList()
Initializes an empty BList.
Definition: BList.cs:58
Adds extension methods to modernize .NET's simple built-in service locator.
Definition: IoC.cs:55
static string Get(Type type)
Computes a short language-agnostic name for a type, including generic parameters, e....
Definition: MemoizedTypeName.cs:24
Extension methods for IOrdered<T>.
Definition: Interfaces.cs:54
This interface exists to work around a limitation of C#; see IPoint<T>.
Definition: IPoint.cs:225
A formatted message with an associated Context.
Definition: ILogMessage.cs:11
Adapter: a reversed of an IList<T>. TODO: unit tests.
Definition: ReversedList.cs:12
static new void ReferenceEquals(object a, object b)
Verifies that two references are equal.
Definition: MiniTest.cs:475
int RemoveAll(K key)
Removes all the items from the collection whose key compares equal to the specified key.
Definition: BMultiMap.cs:203
@ StopBeforeOverflow
Changes overflow handling behavior when parsing an integer, so that the result does not overflow (wra...
Marks a test that is expected to throw an exception of a particular type. The test fails if the expec...
Definition: MiniTest.cs:174
abstract MatchType LA0Int
Returns the token type of _lt0 (normally _lt0.TypeInt)
Definition: BaseParser.cs:93
static StringBuilder UnescapeCStyle(UString s, out EscapeC encountered, bool removeUnnecessaryBackslashes=false)
Unescapes a string that uses C-style escape sequences, e.g. "\\\n\\\r" becomes "\n\r".
Definition: ParseHelpers.cs:86
virtual bool RemoveObserver(IAListTreeObserver< K, T > observer)
Removes a previously attached tree observer from this list.
Definition: AListBase.cs:1172
void Sort(Comparison< T > comp)
Uses a specialized "tree quicksort" algorithm to sort this list using the specified Comparison<T>.
Definition: AList.cs:367
override void SetAt(uint index, T item, IAListTreeObserver< K, T > tob)
Sets an item at the specified sub-index.
Definition: AListInnerBase.cs:348
Bijection(int capacity)
Constructs a bijection out of two Dictionary<TKey,TValue> objects, each with the specified capacity.
Definition: Bijection.cs:46
Encapsulates a ListChanged event that notifies listeners that a list has changed, such as when items ...
Definition: INotifyListChanged.cs:32
bool SaveComments
Controls whether comments and newlines are saved into TriviaList.
Definition: EcsPreprocessor.cs:59
Extension methods for Loyc collection interfaces
Definition: Extended interfaces.cs:81
static string BareHtmlEntityNameForAscii(char c)
Gets a bare HTML entity name for an ASCII character, or null if there is no entity name for the given...
Definition: G.cs:251
abstract long CountSizeInBytes(int sizeOfT, int sizeOfK)
Tallies the memory use of the current node and all child nodes, with the assumption that each object ...
T GetAtDff(int distanceFromFront)
Gets an item WITHOUT doing a range check
Definition: WListBase.cs:297
override bool Equals(object obj)
Definition: NegListSource.cs:108
A simple implementation of IUninterpretedLiteral which can also be turned into an LNode by calling LN...
Definition: UninterpretedLiteral.cs:7
Token IndentToken
Gets or sets the prototype token for indentation markers.
Definition: IndentTokenGenerator.cs:556
This interface exists to work around a limitation of C#; see IPoint<T> and IPoint3<T>.
Definition: IPoint3.cs:52
static ? int FirstIndexWhere< T >(this IEnumerable< T > list, Func< T, bool > pred)
Gets the lowest index at which a condition is true, or null if nowhere.
Definition: EnumerableExt.cs:40
Adapter: converts IEnumerable(Token) to the ILexer<Token> interface.
Definition: TokenListAsLexer.cs:15
Map(IEnumerable< KeyValuePair< K, V >> list)
Creates a map with the specified elements.
Definition: Map.cs:214
bool TryAdd(string key, TValue value)
Adds the specified key-value pair only if the specified key is not already present in the trie.
Definition: CPStringTrie.cs:35
MMap< K, V > Xor(MapOrMMap< K, V > other)
Definition: MMap.cs:302
Represents a "gate" (p => m), which is a mechanism to separate prediction from matching in the contex...
Definition: Predicates.cs:756
static bool GetAndEdit< K, V >(IDictionary< K, V > dict, K key, ref V value, DictEditMode mode)
Default implementation of IDictionaryEx<K, V>.GetAndEdit.
Definition: IDictionaryEx.cs:106
IDictionary< object, object > ScopedProperties
Returns a table of "properties" (arbitrary key-value pairs) that exist in the current scope....
Definition: IMacroContext.cs:27
long CountMemory(int sizeOfT)
Measures the total size of all objects allocated to this collection, in bytes, including the size of ...
Definition: Set.cs:330
static void That(bool condition, string message, params object[] args)
Calls Fail(message, args) if condition is false.
Definition: MiniTest.cs:509
static string WithoutSuffix(this string s, string suffix, StringComparison mode=StringComparison.Ordinal)
Returns a version of the string without the specified suffix. If the string does not have the specifi...
void NodeRemoved(AListNode< K, T > child, AListInnerBase< K, T > parent)
Called when a child node is removed from an inner node.
Definition: AListIndexer.cs:116
static bool UnescapeString(ref UString sourceText, char quoteType, bool isTripleQuoted, Action< int, string > onError, StringBuilder sb, UString indentation=default(UString), bool les3TQIndents=false)
Parses a normal or triple-quoted string whose starting quotes have been stripped out....
Definition: Les2Lexer.cs:203
Symbol Name
Definition: ILNode.cs:50
static object Cache(char o)
Special overload to avoid treating argument as int32 in C#.
Definition: CG.cs:48
Standard extension methods for LNode.
Definition: LNodeExt.cs:13
override Pred Clone()
Deep-clones a predicate tree. Terminal sets and Nodes referenced by the tree are not cloned; the clon...
Definition: Predicates.cs:910
Helper class: EmptyList<T>.Value is a read-only empty list.
Definition: EmptyList.cs:11
This interface provides services offered by the lexical macro processor (LeMP).
Definition: IMacroContext.cs:12
static ? int NextHigherIndex< T >(this ISparseListSource< T > list, int? index)
Gets the next higher index that is not classified as an empty space, or null if there are no non-blan...
Definition: ISparseList.cs:90
abstract bool IsNewline(Trivia trivia)
Returns true if the trivia represents a newline, false otherwise.
volatile bool _isFrozen
Whether the node is knowingly cloned an therefore frozen.
Definition: AListNode.cs:264
bool IsTarget
Returns true if the current node is the target of its parent call node.
Definition: IMacroContext.cs:89
Code related to LLLPG, the Loyc LL(k) Parser Generator (LLLPG.exe).
Definition: NamespaceDocs.cs:120
static bool Any(this ICount c)
Returns true if the collection contains any elements.
Definition: ICount.cs:48
UString IndentString
Gets a string slice that holds the spaces or tabs that were used to indent the current line.
Definition: BaseILexer.cs:63
static Symbol KeyNameComponentOf(LNode name)
Given a complex name such as global::Foo<int>.Bar<T>, this method identifies the base name component,...
Definition: EcsValidators.cs:759
void Add(T item)
Inserts an item at the "front" of the list, which is index 0 for FWList, or Count for WList.
Definition: WListBase.cs:142
An immutable set that implements IPGTerminalSet so that it can be used by LLParserGenerator.
Definition: GeneralCodeGenHelper.cs:266
virtual void Prepend(SparseAList< T > other)
Prepends an AList to this list in sublinear time.
Definition: SparseAList.cs:199
new void Skip()
Definition: LexerSource.cs:95
static object ParseNumberCore(UString source, bool isNegative, int numberBase, bool isFloat, Symbol typeSuffix, out string error)
Parses the digits of a literal (integer or floating-point), not including the radix prefix (0x,...
Definition: Les2Lexer.cs:541
Suggested base class for custom code generators. Each derived class is typically designed for a diffe...
Definition: CodeGenHelperBase.cs:26
LNode MatchCast
If MatchCast is set, a cast to this type is added when calling Match() or NewSet() or set....
Definition: GeneralCodeGenHelper.cs:76
static bool True(Action action)
This method simply calls the delegate provided and returns true. It is used to do an action in a cond...
Definition: G.cs:141
bool SkipValueParsing
Used for syntax highlighting, which doesn't care about token values. This option causes the Token....
Definition: Les2Lexer.cs:34
Standard extension methods for ISourceRange.
Definition: ISourceRange.cs:18
bool Contains(T item)
Returns true if-and-only-if the specified item exists in the list.
Definition: AList.cs:775
static int CountOnes(int x)
Returns the number of bits that are set in the specified integer.
Definition: G.cs:288
void ItemAdded(T item, AListLeafBase< K, T > parent)
Called when an item is added to a leaf node.
Definition: AListNodeObserver.cs:76
ParserSource(IList< Token > list, Token eofToken, ISourceFile file, int startIndex=0)
<inheridoc>
Definition: ParserSource.cs:133
Thrown by Assert.Success().
Definition: MiniTest.cs:214
static readonly ParsingMode Expressions
Tells IParsingService.Parse to treat the input as a single expression or expression list (which,...
Definition: ParsingMode.cs:19
FVList< T > SmartSelect(Func< T, T > map)
Maps a list to another list of the same length.
Definition: FVList.cs:585
T SubOne(T a)
Returns a - 1.
Localize is a global hook into which a string-mapping localizer can be installed. It makes your progr...
Definition: Localize.cs:194
VListBlockArray(FVList< T > prior, T firstItem)
Inits an immutable block with one item.
Definition: VListBlockArray.cs:45
@ TypeKeyword
e.g. int, bool, double, void
void Add(T item)
Adds an item to the heap (synonym of Push()). Complexity: O(Count).
Definition: Heap.cs:85
override Pred CodeToTerminalPred(LNode expr, ref string errorMsg)
Creates a terminal predicate from a code expression.
Definition: IntStreamCodeGenHelper.cs:39
LNode ListInitializer
Gets or sets the initializer expression for lists created with the +: operator (default: new List<T>(...
Definition: CodeGenHelperBase.cs:70
int StartIndex
Character index where the token starts in the source file.
Definition: Token.cs:600
static LNode ParseSingle(this IParsingService parser, ICharSource text, string fileName, IMessageSink msgs=null, IParsingOptions options=null)
Parses a string and expects exactly one output.
Definition: IParsingService.cs:270
virtual LNode GenerateSkip(bool savingResult)
Returns (Skip()), or (MatchAny()) if the result is to be saved.
Definition: CodeGenHelperBase.cs:206
int IndexOfExact(T item)
Specialized search function that finds the index of an item that not only compares equal to the speci...
Definition: BList.cs:423
string IndentString
Specifies the string to use for each level of indentation of nested constructs in the language,...
Definition: ILNodePrinterOptions.cs:61
Enables access to TryGet extension methods for retrieving items from a collection without risk of exc...
Definition: Other interfaces.cs:54
static Func< object, string > ContextToString
Gets the strategy that message sinks should use to convert a context object to a string.
Definition: MessageSink.out.cs:129
override int GetRelativeCostForSwitch(IPGTerminalSet set)
Used to help decide whether a "switch" or an if statement will be used to handle a prediction tree,...
Definition: IntStreamCodeGenHelper.cs:213
static string DataList(this Exception ex)
Converts Exception.Data to a string, separating each key-value pair by a newline.
Definition: Extensions.cs:123
int NextTempCounter
Gets the next number to use as a suffix for temporary variables (without incrementing it).
Definition: IMacroContext.cs:122
Sends all messages to System.Console.WriteLine(), with hard-coded colors for Error,...
Definition: BasicSinks.cs:19
@ PriorityInternalOverride
Used to order behavior of standard macros.
Helper type returned from LCExt.AsListSource<T>.
Definition: ListAsListSource.cs:43
override int GetHashCode()
Returns the hashcode of the wrapped object.
Definition: ReversedList.cs:31
T Width
Gets the width of a rectangle (the difference between X coordinates).
Definition: IRectangle.cs:14
static bool operator!=(LNodeList lhs, LNodeList rhs)
Returns whether the two list references are different. Does not compare the contents of the lists.
Represents a range of integers of a specified data type.
Definition: NumRange.cs:21
static void Resize< T >(this List< T > list, int newSize)
Resizes a list by removing items from the list (if it is too long) or adding default(T) values to the...
Definition: ListExt.cs:133
Helper type. You pass a cloneable Frame object to the constructor, and then a copy of this Frame is u...
Definition: NestedEnumerator.cs:147
Definition: ICollectionSource.cs:50
IListSource< LNode > Parse(ILexer< Token > input, IMessageSink msgs, IParsingOptions options)
If HasTokenizer is true, this method accepts a lexer returned by Tokenize() and begins parsing.
Definition: Les2LanguageService.cs:67
static bool IsOpChar(char c)
Returns true if this character is one of those that operators are normally made out of in LES.
Definition: LesPrecedenceMap.cs:210
Token DedentToken
Gets or sets the prototype token for unindentation markers.
Definition: IndentTokenGenerator.cs:563
Extension methods and helper methods for List<T>, IList<T>, IReadOnlyList<T>, arrays,...
Definition: ROLSlice.cs:10
StandardTriviaInjector(IListSource< Token > sortedTrivia, ISourceFile sourceFile, int newlineTypeInt, string mlCommentPrefix, string mlCommentSuffix, string slCommentPrefix, bool topLevelIsBlock=true)
Initializes StandardTriviaInjector.
Definition: StandardTriviaInjector.cs:98
Checkpoint Newline(int changeIndentLevel=0)
Writes a newline and the appropriate amount of indentation afterward.
Definition: PrinterState.cs:123
static bool IsInRange(this int num, int lo, int hi)
Returns true if num is between lo and hi.
Definition: GRange.out.cs:27
bool CastLA
Whether to cast the result of LA0 and LA(i) to LaType (default: true)
Definition: GeneralCodeGenHelper.cs:40
int CompareTo(IntRange other)
Compares only the Lo values of two ranges.
Definition: IntSet.cs:625
Slice_(IListSource< T > list, int start, int count=int.MaxValue)
Initializes a slice.
Definition: Slice.cs:53
abstract int Capacity
Returns the maximum number of elements in this block
Definition: VListBlock.cs:310
bool IsProperSupersetOf(IEnumerable< T > other)
Definition: MSet.cs:285
Either< Symbol, ILogMessage > TryPrint(ILNode literal, StringBuilder sb)
Searches Printers for a printer for the value and uses it to convert the value to a string....
Definition: LiteralHandlerTable.cs:155
int FindLowerBound(K key, out V value, out bool found)
Finds the lowest index of an item that is equal to or greater than the specified item.
Definition: BMultiMap.cs:366
@ StatementBlock
The node's immediate children (and/or the node itself) should be printed in statement notation,...
The methods of Token in the form of an interface.
Definition: Token.cs:616
FWList is the mutable variant of the FVList data structure.
Definition: FWList.cs:31
This interface is intended to be implemented by editable collection classes that are not indexable li...
Definition: Extended interfaces.cs:24
static Symbol SpaceDefinitionKind(LNode n, Pedantics p=Pedantics.Lax)
Returns the space kind, which is one of the names #struct, #class, #enum, #interface,...
Definition: EcsValidators.cs:130
Represents a Deque that supports negative indexes. In this kind of Deque, pushing and popping element...
Definition: INegListSource.cs:99
LNode ResolveAlias(LNode expr)
Returns the node for an alias. If the specified node is not an alias, returns the same node unchanged...
Definition: CodeGenHelperBase.cs:98
bool AddPrinter(bool replaceExisting, Symbol type, Func< ILNode, StringBuilder, Either< Symbol, LogMessage >> printer)
Adds a printer to the Printers collection.
void AddAll(AListNode< K, T > node)
Called when all children are being added to a node (leaf or inner). Notifications are not sent for in...
void CheckPoint()
Called when a tree modification operation is completed.
virtual bool HasImplicitLeadingNewline(LNode child, LNode parent, int indexInParent)
Called to find out if a newline is to be added implicitly before the current child of the specified n...
Definition: StandardTriviaInjector.cs:147
int FindLowerBound(ref K key, out bool found)
Definition: BDictionary.cs:228
@ NoReprocessing
The macro's result (including children) is not processed further. This flag only takes effect when th...
static IListSource< T > AsListSource< T >(this IList< T > c)
Adapter: treats any IList{T} object as IListSource{T}.
Definition: ListAsListSource.cs:20
Contains classes related to Loyc Expression Syntax (LES), including the parser and printer (reachable...
Definition: NamespaceDocs.cs:106
static Symbol MethodDefinitionKind(LNode n, out LNode retType, out LNode name, out LNode args, out LNode body, bool allowDelegate=true, Pedantics p=Pedantics.Lax)
If the given node has a valid syntax tree for a method definition, a constructor, or (when orDelegate...
Definition: EcsValidators.cs:218
static readonly Symbol Braces
"{}" Creates a scope.
Definition: CodeSymbols.cs:69
override int AdjustWListIndex(int index, int size)
This method implements the difference between FWList and WList: In FWList it returns index,...
Definition: WList.cs:34
static Maybe< V > AddOrGetExisting< K, V >(this IDictionaryEx< K, V > dict, K key, V value)
Adds a new key/value pair if the key was not present, or gets the existing value if the key was prese...
Definition: IDictionaryEx.cs:148
int SliceStart
Index where this range starts within the InnerList.
Definition: IRanges.cs:309
bool PrematchByDefault
If true, rules that are not marked private, public, or internal are assumed not to be called from out...
Definition: LLParserGenerator.cs:126
int MoveNext(ref Frame frame, ref T current)
Enumerates the next item, or the next child collection.
T Pop()
Removes the back item (at index Count-1) from the list and returns it.
Definition: WList.cs:241
Either< object, ILogMessage > TryParse(UString textValue, Symbol typeMarker)
Attempts to parse a string with a given type marker.
@ BinaryLiteral
Used for a binary (base-2) literal like 0b11111.
void Start()
Causes the operating system to change the state of the current instance to System....
Definition: ThreadEx.cs:98
abstract LNode Target
Returns the target of a method call, or null if IsCall is false. The target can be a symbol with no n...
Definition: LNode.cs:366
void Abort()
Definition: ThreadEx.cs:248
Definition: LlpgGeneralTestsBase.cs:21
bool IsFloatingPoint
Returns true if T is floating-point, meaning that it can represent very large and very small numbers,...
Definition: Interfaces.cs:126
Represents a mutable 3D rectangular prism.
Definition: IRectangle3.cs:67
bool TryGetValue(K key, out V value)
Finds a value associated with the specified key.
Definition: BMultiMap.cs:213
@ HasLongEscape
While unescaping, a valid \U escape was encountered with more than 4 digits. To detect whether the va...
static bool operator!=(VList< T > lhs, VList< T > rhs)
Returns whether the two list references are different. Does not compare the contents of the lists.
Definition: VList.cs:132
bool PrintTriviaExplicitly
If supported by the printer, this option causes comments and spaces to be printed as attributes in or...
Definition: ILNodePrinterOptions.cs:36
MacroProcessor(IMessageSink sink, Type prelude)
Initializes MacroProcessor.
Definition: MacroProcessor.cs:100
Definition: TestStaticDeconstructMacro.cs:10
int IndexOfExact(K key)
Specialized search function that finds the first index of an item whose key compares equal to the spe...
Definition: BMultiMap.cs:441
object Pred
The predicate to match and backtrack. Must be of type LNode or Pred.
Definition: Predicates.cs:889
Symbol ToSuffixOpName(object symbol)
Given a normal operator symbol like (Symbol)"'++", gets the suffix form of the name,...
Definition: LesPrecedenceMap.cs:268
static readonly Symbol Eq
"==" Equality test operator
Definition: CodeSymbols.cs:45
static int Log2Floor(int x)
Returns the floor of the base-2 logarithm of x. e.g. 1024 -> 10, 1000 -> 9
Definition: G.cs:331
static readonly InternalSet< T > Empty
An empty set.
Definition: InternalSet.cs:372
override int GetHashCode()
Returns a hash code for the current thread.
Definition: ThreadEx.cs:256
static R[] SelectArray< T, R >(this ICollection< T > input, Func< T, R > selector)
Maps a list to an array of the same length.
Definition: ICollectionExt.cs:31
static IListSource< LNode > ParseFile(this IParsingService parser, string fileName, IMessageSink msgs=null, ParsingMode inputType=null, bool preserveComments=true)
Opens the specified file, parses the entire file, and closes the file.
Definition: IParsingService.cs:296
T NextHigherItem(ref int? index)
Increases index by at least one to reach the next index that is not classified as empty space,...
Definition: ListSourceAsSparse.cs:56
static int NumberOfUnmatchedMethods
The number of methods in the interface for which a matching method in T could not be found.
Definition: GoInterface.cs:490
AListBase(AListBase< K, T > items, bool keepListChangingHandlers)
Cloning constructor. Does not duplicate the observer (IAListTreeObserver<K,T>), if any,...
Definition: AListBase.cs:240
bool IsProperSubsetOf(IEnumerable< T > other, IEqualityComparer< T > comparer, int myExactCount)
Returns true if all items in this set are present in the other set, and the other set has at least on...
Definition: InternalSet.cs:1557
static readonly Symbol XorBits
"^" Bitwise exclusive-or operator
Definition: CodeSymbols.cs:67
Shared base class of FWList and WList.
Definition: WListBase.cs:352
IPGTerminalSet Inverted()
Creates a version of the set with IsInverted toggled.
Adapter: a IBinumerator<T> that swaps the MoveNext() and MovePrev() methods.
Definition: ReverseBinumerator.cs:9
void NodeAdded(AListNode< K, T > child, AListInnerBase< K, T > parent)
Called when a child node is added to an inner node.
IEnumerable< string > FileExtensions
Standard file extensions for this language, without leading dots, with the first one being the most c...
Definition: IParsingService.cs:30
virtual bool Calls(Symbol name, int argCount)
Returns true if Name == name and Max + 1 == argCount (which implies Kind == LNodeKind....
Definition: LNode.cs:725
void CopyTo(T[] array, int arrayIndex)
Copies the elements of the collection to an Array, starting at a particular array index.
Definition: FVList.cs:414
abstract AListNode< K, T > DetachedClone()
Creates an unfrozen shallow duplicate copy of this node. The child nodes (if this is an inner node) a...
FVList< T > Transform(VListTransformer< T > x)
Transforms a list (combines filtering with selection and more).
Definition: FVList.cs:725
override Pred Clone()
Deep-clones a predicate tree. Terminal sets and Nodes referenced by the tree are not cloned; the clon...
Definition: Predicates.cs:257
bool HasTokenizer
Returns true if the Tokenize method is available.
Definition: IParsingService.cs:33
@ PriorityInternalFallback
Used to order behavior of standard macros.
@ AllowUnmatchedMethods
Allow the cast even if NumberOfUnmatchedMethods > 0
override void Error(int lookaheadIndex, string format, params object[] args)
This method is called to format and handle errors that occur during lexing. The default implementatio...
Definition: LexerSource.cs:176
abstract T FGet(int index, int localCount)
Gets an item at distance 'index' from the front (beginning of an FVList)
static bool IsSpecialName(string name)
Returns true if name is considered a "special" name that starts with any character below 48 in ASCII,...
Definition: LNode.cs:311
void Resize(int newSize, bool allowReduceCapacity)
Makes the list larger or smaller, depending on whether newSize is larger or smaller than Count.
Definition: InternalList.cs:149
override bool AllowChangeParentheses
Introduces extra parenthesis to express precedence, without using an empty attribute list [] to allow...
Definition: Les2Printer.cs:676
static Slice_< T > SkipNowWhile< T >(this IListSource< T > list, Func< T, bool > predicate)
Returns a slice without the initial elements of the list that meet the specified criteria....
Definition: LinqToLists.out.cs:146
An exception thrown by an enumerator when it detects that the collection was modified after enumerati...
Definition: Exceptions.cs:101
static int LastIndexOf(this StringBuilder sb, UString searchStr, int startIndex=int.MaxValue, bool ignoreCase=false)
Gets the index of a substring in a StringBuilder
Definition: StringBuilderExt.cs:116
Les3PrettyPrinter(StringBuilder target, IMessageSink sink, ILNodePrinterOptions options)
Creates an instance of this class, which produces plain LES augmented with control codes.
Definition: Les3PrettyPrinter.cs:35
int Max
Returns the maximum valid index, which is Min + OriginalList.Count - 1.
Definition: NegListSource.cs:76
int LineNumber
Current line number (1 for the first line).
Definition: ILexer.cs:31
Map< K, V > Intersect(MapOrMMap< K, V > other)
Returns a copy of the current map with all keys removed from this map that are not present in the oth...
Definition: Map.cs:325
IListSource< T > OriginalList
Gets the list that was passed to the constructor of this instance.
Definition: NegListSource.cs:43
void Add(byte[] key, int offset, int length, TValue value)
Adds the specified key-value pair to the trie, throwing an exception if the key is already present.
Definition: CPByteTrie.cs:33
long? Size
Gets the number of integers whose membership test would succeed (the maximum possible value is 0x1000...
Definition: IntSet.cs:429
@ Spaces
Spaces, tabs, non-semantic newlines, and EOF
override void Reset()
Forgets previously encountered operators to save memory.
Definition: LesPrecedenceMap.cs:309
static readonly Symbol _Dereference
Alias for Mul.
Definition: CodeSymbols.cs:33
A wrapper around Stopwatch with a more convenient interface, currently oriented around measuring mill...
Definition: EzStopwatch.cs:50
Extension methods for Type.
Definition: Extensions.cs:15
bool IsEnabled(Severity level)
Returns true if messages of the specified type will actually be printed, or false if Write(type,...
Definition: WrapperSinks.cs:57
virtual bool HandleUndersized(int i, IAListTreeObserver< K, T > tob)
This is called by RemoveAt(), DoSingleOperation() for B+ trees, or by the constructor called by CopyS...
Definition: AListInnerBase.cs:440
Interface for reading the size of a 3D object.
Definition: IRectangle3.cs:10
This helper class gives a nice view of a custom collection within the debugger.
Definition: CollectionDebugView.cs:25
virtual void Get(UString name, out Symbol sym)
Workaround for lack of covariant return types in C#
Definition: Symbol.cs:266
IndexPositionMapper(CharSource source, ILineColumnFile startingPos=null)
Initializes CharIndexPositionMapper.
Definition: IndexPositionMapper.cs:46
void RootChanged(AListBase< K, T > list, AListNode< K, T > root, bool clear)
Called when the root of the tree changes, or when the list is cleared. Also called after Attach(),...
MMap(IEnumerable< KeyValuePair< K, V >> copy, IEqualityComparer< K > comparer)
Creates a map with the specified elements and key comparer.
Definition: MMap.cs:51
bool SpaceInsideTuples
Whether to print a space inside tuples like f( ...; ).
Definition: Les3PrinterOptions.cs:52
A mutable 2D point with X and Y coordinates.
Definition: IPoint.cs:219
virtual int AdjustWListIndex(int index, int size)
This method implements the difference between FWList and WList: In FWList it returns index,...
Definition: WListBase.cs:95
static void Sort< T >(this IList< T > list)
Definition: ListExt.cs:276
static EventHandler< ThreadStartEventArgs > ThreadStarting
This event is called in the context of a newly-started thread, provided that the thread is started by...
Definition: ThreadEx.cs:76
Adapter: this is a read-only collection of Values read from a generic IDictionary....
Definition: ValueCollection.cs:49
Either< L2, R2 > R2(selectL(_left)) Either< L2, R > R(selectL(_left)) Either< L, R2 > MapRight< R2 >(Func< R, R2 > selectR)
Transforms Right with the given selector, if Right.HasValue. Otherwise, returns Left unchanged.
static string UnescapeCStyle(UString s, bool removeUnnecessaryBackslashes=false)
Unescapes a string that uses C-style escape sequences, e.g. "\\\n\\\r" becomes "\n\r".
Definition: ParseHelpers.cs:73
Describes a series of alternatives (branches), a kleene star (*), or an optional element (?...
Definition: Predicates.cs:309
bool TrySet(int index, T value)
Definition: NegList.cs:98
Holds a single value of one of two types (L or R).
Definition: Either.cs:12
bool IsProperSubsetOf(Set< T > other)
Definition: Set.cs:149
override bool Equals(object obj)
Definition: NegList.cs:124
virtual LNode GenerateMatch(IPGTerminalSet set, bool savingResult, bool recognizerMode)
Generate code to match a set, e.g. MatchRange('a', 'z'); or MatchExcept(' ', '\r'); }....
Definition: CodeGenHelperBase.cs:254
static readonly Precedence StartStmt
Context: beginning of main expression (potential superexpression)
Definition: Les2Printer.cs:244
Definition: EcsParser.cs:87
A reverse view of an AList.
Definition: AListBase.cs:1211
int ItemsInOverflow
Number of items that are in overflow lists. Note that if a single item is in an overflow list,...
Definition: InternalSet.cs:1701
static readonly Symbol XorBitsAssign
"'^=" bitwise-xor-by operator
Definition: CodeSymbols.cs:130
int FindLowerBound(K key, out bool found)
Finds the lowest index of an item with a key that is equal to or greater than the specified key.
Definition: BDictionary.cs:213
static LNode InParens(this LNode node, SourceRange range)
Returns the same node with a parentheses attribute added.
Definition: LNodeExt.cs:319
int SpaceAfterPrefixStopPrecedence
The printer avoids printing spaces after prefix operators that have the specified precedence or highe...
Definition: Les3PrinterOptions.cs:106
static readonly object BoxedTrue
Singleton true cast to object.
Definition: G.cs:144
BList(int maxNodeSize)
Definition: BList.cs:61
int Remove(K key, int maxToRemove)
Removes up to a specified number of items from the collections that have the specified key.
Definition: BMultiMap.cs:177
bool ShouldGenerateSwitch(IPGTerminalSet[] branchSets, MSet< int > casesToInclude, bool hasErrorBranch)
Returns true if a "switch" statement is the preferable code generation technique rather than the defa...
new TokenTree Clone()
Gets a deep (recursive) clone of the token tree.
A common token type recommended for Loyc languages that want to use features such as token literals o...
Definition: Token.cs:78
static Repeated< T > Repeat< T >(T value, int count)
Returns a helper object that stores one value, but acts like a read-only list that repeats the value ...
Definition: Repeated.cs:21
static MacroProcessor Current
Returns the MacroProcessor running on the current thread, or null if none.
Definition: MacroProcessor.cs:89
static List< string > WordWrap(IEnumerable< Pair< int, int >> paragraph, int lineWidth, Func< int, WordWrapCharType > getCharType=null)
Breaks a paragraph into lines using a simple word-wrapping algorithm.
Definition: G.cs:515
A simple base class that helps you use the decorator pattern on a dictionary. By default,...
Definition: DictionaryWrapper.cs:18
static readonly Symbol _Destruct
Alias for NotBits.
Definition: CodeSymbols.cs:66
void Newline()
Default newline parser that matches ' ' or '\r' unconditionally.
Definition: BaseLexer.cs:255
static readonly ParsingMode Statements
Tells IParsingService.Parse to treat the input as a list of statements. If the language makes a disti...
Definition: ParsingMode.cs:24
bool Add(ref T item, IEqualityComparer< T > comparer, bool replaceIfPresent)
Tries to add an item to the set, and retrieves the existing item if present.
Definition: InternalSet.cs:726
BDictionary(Func< K, K, int > compareKeys, int maxLeafSize, int maxInnerSize)
Initializes an empty BDictionary.
Definition: BDictionary.cs:96
NewlineOpt
Flags to control situations in which newlines should be added automatically by the EC# printer.
Definition: EcsNodePrinter.cs:1205
int? RepeatForMs
Gets or sets the recommended minimum length of time to run the test. The test runner will run the tes...
Definition: MiniTest.cs:159
Alternate name for Les2LanguageService (will change to Les3LanguageService in the future)
Definition: Les2LanguageService.cs:114
override void SetValue(TKey key, TValue value)
Implementation of the setter for this[].
Definition: WeakKeyDictionary.cs:69
IBinumerator< T > End()
Returns a binumerator that points after the end of the current collection.
override IEnumerable< LNode > GetCases(IPGTerminalSet set_)
Gets the literals or symbols to use for switch cases of a set (just the values, not including the cas...
Definition: GeneralCodeGenHelper.cs:250
Map< K, V > Except(MapOrMMap< K, V > other)
Returns a copy of the current map with all keys removed from this map that are present in the other m...
Definition: Map.cs:335
void AddStdMacros()
Adds standard macros from LeMP.StdMacros.dll, and adds the namespaces LeMP and LeMP....
Definition: Compiler.cs:382
static IList< T > AsList< T >(this IListSource< T > c)
Converts any IListSource{T} object to a read-only IList{T}.
Definition: ListSourceAsList.cs:22
static ICollection< T > AsCollection< T >(this IReadOnlyCollection< T > c)
Adapter: treats any IReadOnlyCollection{T} as a read-only ICollection{T}.
Definition: SourceAsCollection.cs:21
override void Reset(CharSrc source, string fileName="", int inputPosition=0, bool newSourceFile=true)
Reinitializes the object. This method is called by the constructor.
Definition: BaseILexer.cs:75
FVList< T > Add(T item)
Inserts an item at the front (index 0) of the FVList.
Definition: FVList.cs:394
bool AddIfUnique(K key, V value)
Adds a key-value pair if there is not already a pair that compares equal to the new one.
Definition: BMultiMap.cs:128
Internal implementation class. Represents a pointer to a location within a byte array.
Definition: CPTrieMisc.cs:130
abstract LNodeKind Kind
Returns the LNodeKind: Symbol, Literal, or Call.
Definition: LNode.cs:264
static void DoesNotThrow(Action code, string message, params object[] args)
Verifies that a delegate does not throw an exception
Definition: MiniTest.cs:602
void Optimize()
Optimizes the data structure to consume less memory or storage space.
@ AllowDuplicates
If this macro is ambiguous with one or more macro of the same priority, this flag blocks the ambiguit...
T NaN
Not-a-number or null representation for this type.
Definition: Interfaces.cs:108
static int Skip< R, T >(ref R range, int count)
Advances by the specified number of elements.
Definition: Range.cs:18
static readonly Symbol _UnaryPlus
Alias for Add.
Definition: CodeSymbols.cs:35
An implementation of the LLLPG Lexer API, used with the LLLPG options inputSource and inputClass.
Definition: LexerSource.cs:32
int Count
Gets the number of items in the collection.
Definition: ICount.cs:21
This defines a Group with the operation *, the neutral element One, the inverse Inverse and an operat...
Definition: Interfaces.cs:273
static string EscapeCStyle(UString s, EscapeC flags=EscapeC.Default)
Escapes characters in a string using C style, e.g. the string "Foo\" "</c> maps to <c>"Foo\"\ " by de...
Definition: PrintHelpers.cs:29
static int NextLargerSize(int than, int capacityLimit)
Same as NextLargerSize(int), but allows you to specify a capacity limit, to avoid wasting memory when...
Definition: InternalList.cs:649
InternalSet< T > CloneFreeze()
Freezes the hashtrie so that any further changes require paths in the tree to be copied.
Definition: InternalSet.cs:599
bool Add(T item, bool replaceIfPresent)
Adds the specified item to the set.
Definition: MSet.cs:120
This is a tuple of a FileName, Line, Column, and OriginalIndex.
Definition: LineRemapper.cs:80
Represents a nonterminal, which is a reference to a rule.
Definition: Predicates.cs:212
void Detach(AListBase< K, T > list, AListNode< K, T > root)
Called when the observer is being detached from an AList. Detach(), unlike Attach(),...
Definition: AListNodeObserver.cs:61
object Fails
Setting this property is used to indicate that the test is known to fail. It is used to mark tests th...
Definition: MiniTest.cs:126
static readonly Symbol Missing
Indicates that a syntax element was omitted, e.g. Foo(, y) => Foo(@``, y)
Definition: CodeSymbols.cs:184
VList< T > ToVList()
Returns this list as a VList; if this is a FWList, the order of the elements is reversed at the same ...
Definition: WListBase.cs:337
LineColumnFile IndexToLine(int index)
Returns the position in a source file of the specified index.
Definition: EmptySourceFile.cs:37
static bool IsInRange(this double num, double lo, double hi)
Returns true if num is between lo and hi.
Definition: GRange.out.cs:112
Definition: IPush, IPop.cs:9
bool GetAndEdit(ref K key, ref V value, DictEditMode mode)
Combines a get and change operation into a single method call. You rarely need to call this method di...
Helper class: provides a modified view of an IListSource by transforming each element on-demand....
Definition: SelectListSource.out.cs:63
static readonly Symbol Operator
e.g. #fn(#bool, [#operator] ԉ۪==`, #(Foo a, Foo b))
Definition: CodeSymbols.cs:181
static int CountOnes(byte x)
Returns the number of bits that are set in the specified integer.
Definition: G.cs:275
A mutable 3D point with X, Y, and Z coordinates.
Definition: IPoint3.cs:46
bool IsFrozen
Returns true if the node is explicitly marked read-only. Conceptually, the node can still be changed,...
Definition: AListNode.cs:211
static bool IsInRangeExcludeHi(this float num, float lo, float hi)
Returns true if num is between lo and hi, excluding hi but not lo.
Definition: GRange.out.cs:91
new T First
Gets or sets the value of the first item in the range.
Definition: IRanges.cs:232
static Slice_< T > TakeNowWhile< T >(this IListSource< T > list, Func< T, bool > predicate)
Returns a slice of the initial elements of the list that meet the provided criteria....
Definition: LinqToLists.out.cs:131
Base class for token-printing helper classes. See INodePrinterWriter.
Definition: Les2PrinterWriter.cs:11
new T Y
Vertical coordinate of a point or vector.
Definition: IPoint.cs:37
Symbol(Symbol prototype)
For use by a derived class to produce a statically-typed enumeration in a private pool....
Definition: Symbol.cs:116
T TryPeek(out bool isEmpty)
Gets the last item in the list (at index Count-1).
Definition: VList.cs:227
This interface represents a set of terminals (and only a set of terminals, unlike TerminalPred which ...
Definition: IPGTerminalSet.cs:13
When used with ThreadEx, implementing this base class allows you to be notified when a child thread i...
Definition: ThreadEx.cs:420
sealed override LNode Select(Func< LNode, Maybe< LNode >> selector, ReplaceOpt options=ReplaceOpt.ProcessAttrs)
Transforms the Target, parameters, and optionally the attributes of an LNode, returning another LNode...
Definition: AbstractNodes.cs:154
Standard extension methods for IParsingService.
Definition: IParsingService.cs:95
Prints a Loyc tree in LES (Loyc Expression Syntax) format.
Definition: Les2Printer.cs:18
Adapter from IListSource<T> to ISparseListSource<T>.
Definition: ListSourceAsSparse.cs:28
int Count
Total number of messages that have been discarded.
Definition: BasicSinks.cs:108
abstract T RGet(int index, int localCount)
Gets an item at distance 'index' from the back (beginning of a VList)
static Interface From(T obj, CastOptions opt)
Creates a wrapper if T matches Interface according to the specified CastOptions.
Definition: GoInterface.cs:447
Definition: ICollectionSource.cs:9
ListChangingHandler< T, TCollection > ListChanging
Occurs when the collection associated with this interface is about to change.
Definition: INotifyListChanging.cs:52
static long PutInRange(this long n, long min, long max)
Returns num clamped to the range min and max.
Definition: GRange.out.cs:65
T First
Returns the first value in the range, without popping it.
Definition: IRanges.cs:187
Definition: MacroProcessorTests.cs:109
EmptyArray<T>.Value lets you avoid allocating an empty array on the heap.
Definition: EmptyArray.cs:9
string Name
Gets or sets the name of the thread.
Definition: ThreadEx.cs:229
int? MinTrials
Gets or sets the recommended minimum number of times to run the benchmark in order to get an average....
Definition: MiniTest.cs:166
UString IndentString
Gets a string slice that holds the spaces or tabs that were used to indent the current line.
Definition: ILexer.cs:29
UString Slice(int start, int count=int.MaxValue)
Returns a substring from the character source. If some of the requested characters are past the end o...
Definition: UString.cs:300
int? BlockChainLength
Gets the number of blocks used by this list.
Definition: FVList.cs:267
virtual LNode GenerateSwitch(IPGTerminalSet[] branchSets, LNode[] branchCode, MSet< int > casesToInclude, LNode defaultBranch, LNode laVar)
Generates a switch statement with the specified branches where branchCode[i] is the code to run if th...
Definition: CodeGenHelperBase.cs:343
Reverses the order used by an IComparer object.
Definition: ReverseComparer.cs:9
An interface that is called to notify observers when items or nodes in the tree of a class derived fr...
Definition: IAListTreeObserver.cs:40
Identifies a class that contains unit tests, or methods that return other tests or test fixtures.
Definition: MiniTest.cs:25
Ambiguity
Internal enum (marked public for an obscure technical reason). These are flags that represent special...
Definition: EcsNodePrinter.cs:356
T[] ToArray()
Returns the FVList converted to an array.
Definition: FVList.cs:255
VList< T > Tail
Returns a list without the last item. If the list is empty, an empty list is retured.
Definition: VList.cs:101
@ BreakBefore
Represents a character before which a line break can be added.
void AfterNewline(bool ignoreIndent, bool skipIndent)
Definition: BaseILexer.cs:137
abstract void SetValue(TKey key, TValue value)
Implementation of the setter for this[].
Encodes and decodes BAIS (Byte Array In String) encoding, which preserves runs of ASCII characters un...
Definition: ByteArrayInString.cs:61
static string Print(this ILNodePrinter printer, IEnumerable< LNode > nodes, IMessageSink sink=null, ParsingMode mode=null, ILNodePrinterOptions options=null)
Serializes a list of syntax trees to a string in the syntax supported by the specified ILNodePrinter.
Definition: ILNodePrinter.cs:54
An exception thrown when an object detects that its own state is invalid, or in other words,...
Definition: Exceptions.cs:16
abstract AListInnerBase< K, T > SplitAt(int divAt, out AListNode< K, T > right)
Splits this node into two halves
static IEnumerable< Base > Upcast< Base, Derived >(this IEnumerable< Derived > list)
Upcasts a sequence.
Definition: EnumerableExt.cs:382
static ListSlice< T > Skip< T >(this IList< T > list, int start)
Skips the specified number of elements immediately and returns a slice of part of the list that remai...
Definition: LinqToLists.out.cs:310
A message sink that puts the messages it receives in a list.
Definition: MessageHolder.cs:12
A singleton to be used as the value of Alts.ErrorBranch, representing the default_error branch.
Definition: Predicates.cs:997
static readonly Symbol Yield
e.g. #return(x); <=> return x; [#yield] #return(x) <=> yield return x;
Definition: CodeSymbols.cs:191
void ExitWriteLock()
Releases a write lock that was acquired with EnterWrite().
Definition: ThreadEx.cs:411
static LNodeList GetTrailingTrivia(this LNodeList attrs)
Gets all trailing trivia attached to the specified node.
Definition: LNodeExt.cs:33
Precedence RightContext(Precedence outerContext)
For use in printers. Auto-raises the precedence floor to prepare to print an expression on the right ...
Definition: Precedence.cs:261
override CallNode WithArgs(LNodeList args)
Creates a Node with a new argument list. If this node is not a call, a new node is created using this...
Definition: AbstractNodes.cs:107
@ Normal
The macro's result is reprocessed directly (this is the default behavior).
FWList< T > ToFWList()
Returns this list as a FWList.
Definition: FVList.cs:237
static string UnescapeQuotedString(ref UString sourceText, Action< int, string > onError, UString indentation=default(UString), bool les3TQIndents=false)
Parses a normal or triple-quoted string that still includes the quotes. Supports quote types '\'',...
Definition: Les2Lexer.cs:172
static Maybe< V > GetAndSet< K, V >(this IDictionaryEx< K, V > dict, K key, V value)
Associates a key with a value in the dictionary, and gets the old value if the key was already presen...
Definition: IDictionaryEx.cs:175
void ItemAdded(T item, AListLeafBase< K, T > parent)
Called when an item is added to a leaf node.
readonly int SizeChange
Gets the amount by which the collection size changes. When items are being added, this is positive,...
Definition: ListChangeInfo.cs:69
override Maybe< Token > NextToken()
Returns the next (postprocessed) token. This method should set the _current field to the returned val...
Definition: WhitespaceFilter.cs:14
BDictionary< K, V > Clone(bool keepListChangingHandlers)
Clones a BDictionary.
Definition: BDictionary.cs:414
LNode Run(ISourceFile sourceFile)
Generates a braced block of code {...} for the grammar described by the rules that were previously ad...
Definition: LLParserGenerator.cs:722
WList< T > ToWList()
Returns this list as an WList, which effectively reverses the order of the elements.
Definition: FWList.cs:264
bool OmitMissingArguments
When an argument to a method or macro has the value @``, it will be omitted completely if this flag i...
Definition: Les2Printer.cs:687
Enumerator for FVList; also used by FWList.
Definition: FVList.cs:450
Contains Precedence objects that represent the precedence levels of LES.
Definition: LesPrecedence.cs:238
bool? AllowParallel
Indicates whether this test can be run in parallel with other tests in different test fixtures.
Definition: MiniTest.cs:104
bool AddCsLineDirectives
Whether to add #line directives for C# before and after user actions.
Definition: LLParserGenerator.cs:121
T[] ToArray()
Returns the FWList converted to an array.
Definition: FWList.cs:271
SelectDictionaryFromKeys(IReadOnlyCollection< K > keys, Func< K, Maybe< V >> tryGetValue, Func< K, V > getValue=null)
Initializes the adapter.
Definition: SelectDictionaryFromKeys.cs:71
bool FullLLk
Whether to use full LL(k) or "partly approximate" lookahead.
Definition: LLParserGenerator.cs:100
static readonly Symbol _Concat
Alias for NotBits. Concat operator in D.
Definition: CodeSymbols.cs:65
abstract void Reset()
Called when a new, separate printing operation begins.
bool IsEnabled(Severity level)
Always returns false.
A structure that helps you to write coroutines, or to avoid the performance penalty of nested iterato...
Definition: Co.cs:76
void ClearSpace(int index, int count=1)
Unsets the range of indices index to index+count-1 inclusive. If index + count > Count,...
Provides methods for converting common numeric types to another numeric type "T".
Definition: Interfaces.cs:27
Map(IEnumerable< KeyValuePair< K, V >> list, IEqualityComparer< K > comparer)
Creates a map with the specified elements and key comparer.
Definition: Map.cs:216
Precedence(int left, int right)
Initializes an operator with different precedence on the left and right sides. For a right associativ...
Definition: Precedence.cs:229
bool GetAndEdit(ref K key, ref V value, DictEditMode mode)
Combines a get and change operation into a single method call. You rarely need to call this method di...
Definition: MMap.cs:178
int Max
Returns the maximum valid index in the collection.
Definition: INegListSource.cs:23
A dictionary in which the values are weak. When a value has been garbage- collected,...
Definition: WeakValueDictionary.cs:23
sealed override Token LT(int i)
Returns the Token at lookahead i, where 0 is the next token. This class does not support negative loo...
Definition: BaseParserNoBacktracking.cs:76
bool IsValid
Returns true if this enumerator points to an item and Current is valid.
Definition: CPTrieMisc.cs:94
static void Contains(object expected, IEnumerable actual)
Asserts that an object is contained in a list.
Definition: MiniTest.cs:985
virtual void Error(int lookaheadIndex, string format, params object[] args)
Definition: BaseParser.cs:165
bool IsCharSet
Controls the default stringization mode. When IsCharSet, the set "(36, 65..90, 126)" prints as "[$A-Z...
Definition: IntSet.cs:35
static readonly Symbol This
"#this" e.g. this.X <=> #this.X; this(arg) <=> #this(arg).
Definition: CodeSymbols.cs:179
int SpaceAroundInfixStopPrecedence
The printer avoids printing spaces around infix (binary) operators that have the specified precedence...
Definition: Les2Printer.cs:725
static Exception Catch(Action code, string message, params object[] args)
Verifies that a delegate throws an exception when called and returns it.
Definition: MiniTest.cs:582
bool RemoveCurrent(ref InternalSet< T > set)
Removes the current item from the set, and moves to the next item.
Definition: InternalSet.cs:1195
Enumerator for MSet<T>.
Definition: Set.cs:107
Pair.Create(a, b) is a helper method for making pairs.
Definition: Pair.cs:11
A hash-trie data structure for use inside other data structures.
Definition: InternalSet.cs:367
A small helper class for languages such as C# and C++ that permit the locations reported by error mes...
Definition: LineRemapper.cs:92
IPGTerminalSet UnionCore(IPGTerminalSet other)
Merges two sets.
Definition: GeneralCodeGenHelper.cs:280
T One
Returns the "one" or identity value of this type.
Definition: Interfaces.cs:88
Definition: TestUseSymbolsMacro.cs:10
virtual void Error(int lookaheadIndex, string message)
Records an error or throws an exception.
Definition: BaseParser.cs:160
void NodeRemoved(AListNode< K, T > child, AListInnerBase< K, T > parent)
Called when a child node is removed from an inner node.
static bool IsNormalMethod(LNode n, Pedantics p=Pedantics.Lax)
Alias for MethodDefinitionKind(LNode,bool,Pedantics) that returns true if MethodDefinitionKind return...
Definition: EcsValidators.cs:198
LNode TerminalType
Type of variables auto-declared when you use labels in your grammar (e.g. x:Foo (list+:Bar)*)
Definition: IPGCodeGenHelper.cs:262
static bool TryParseUInt(ref UString s, out BigInteger result, int radix=10, ParseNumberFlag flags=0)
Definition: ParseHelpers.cs:359
static string Left(this string s, int count)
Returns the leftmost 'count' characters of 's', or s itself if count > s.Length.
Definition: StringExt.cs:59
virtual LNode MakeInitializedVarDecl(LNode type, bool wantList, Symbol varName)
Gets a variable declaration for the specified type, e.g. if type is Foo and wantList == true and varN...
Definition: CodeGenHelperBase.cs:505
This interface models the capabilities of an array: getting and setting elements by index,...
Definition: Other interfaces.cs:22
static bool IsPropertyDefinition(LNode n, Pedantics p=Pedantics.Lax)
Returns true iff the given node has a valid syntax tree for a property definition.
Definition: EcsValidators.cs:255
WList< T > WhereSelect(Func< T, Maybe< T >> filter)
Filters and maps a list with a user-defined function.
Definition: WList.cs:160
static void Ignore()
Short for Ignore("").
Definition: MiniTest.cs:319
SpaceOpt SpaceOptions
Controls the locations where spaces should be emitted.
Definition: EcsNodePrinter.cs:1367
UString Left(int length)
Returns the leftmost length code units of the string, or fewer if the string length is less than leng...
Definition: UString.cs:378
VList< T > SmartSelect(Func< T, T > map)
Maps a list to another list of the same length.
Definition: VList.cs:589
void RootChanged(AListBase< K, T > list, AListNode< K, T > newRoot, bool clear)
Called when the root of the tree changes, or when the list is cleared. Also called after Attach(),...
Definition: AListNodeObserver.cs:66
abstract CallNode WithArgs(LNodeList args)
Creates a Node with a new argument list. If this node is not a call, a new node is created using this...
static string QuickRun(string input, params Assembly[] macroAssemblies)
Run macro processor for LLLPG on the specified input, with the specified command-line option map,...
Definition: Program.cs:54
override IEnumerable< LNode > GetCases(IPGTerminalSet set)
Gets the literals or symbols to use for switch cases of a set (just the values, not including the cas...
Definition: IntStreamCodeGenHelper.cs:221
bool CompactMode
When this flag is set, the amount of whitespace in the output is reduced in a printer-defined way,...
Definition: ILNodePrinterOptions.cs:52
virtual void Append(AList< T > other, bool move)
Appends another AList to this list in sublinear time.
Definition: AList.cs:337
static EventHandler< ThreadStartEventArgs > ThreadStopping
This event is called when a thread is stopping, if the thread is stopping gracefully and provided tha...
Definition: ThreadEx.cs:83
virtual void ClearInternal(bool forceClear)
Clears the tree.
Definition: AListBase.cs:570
static string Right(this string s, int count)
Returns the rightmost 'count' characters of 's', or s itself if count > s.Length.
Definition: StringExt.cs:50
bool GetAndSet(ref K key, ref V value)
Associates the specified value with the specified key, while getting the old value if one exists.
Definition: BDictionary.cs:496
IRange< T > Slice(int start, int count=int.MaxValue)
Returns a sub-range of this list.
Definition: NegListSource.cs:93
void CopyTo(T[] array, int arrayIndex)
Copies the elements of the collection to an Array, starting at a particular array index.
Definition: AListBase.cs:637
static string Description(this Exception ex)
Definition: Extensions.cs:62
Encapsulates the ListChanging event that notifies listeners of dynamic changes to a collection,...
Definition: INotifyListChanging.cs:34
Contains Precedence objects that represent the precedence rules of EC#.
Definition: EcsPrecedence.cs:51
A mutable bidirectional range.
Definition: IRanges.cs:267
abstract bool IsUndersized
Returns true if the node is undersized, meaning it would prefer to have more immediate children.
Definition: AListNode.cs:167
An base class designed for parsers that use LLLPG (Loyc LL(k) Parser Generator). Note: this is the ol...
Definition: BaseParser.cs:16
static IReadOnlyDictionary< K, V > AsReadOnlyDictionary< K, V >(this IReadOnlyCollection< K > keys, Func< K, Maybe< V >> tryGetValue, Func< K, V > getValue=null)
Converts a collection of keys to an IReadOnlyDictionary, based on a function that can obtain a value ...
Definition: SelectDictionaryFromKeys.cs:49
virtual LNode GetEmptyResultSet()
A method called to create a virtual node, in order to apply trivia to a source file that is completel...
Definition: AbstractTriviaInjector.cs:167
LNode MakeInitializedVarDecl(LNode type, bool wantList, Symbol varName)
Gets a variable declaration for the specified type, e.g. if type is Foo and wantList == true and varN...
static int RunMany(params object[] os)
Runs all tests in an array of test objects.
Definition: RunTests.cs:92
NegList(IList< T > list, int zeroOffset)
Initializes a NegListSource wrapper.
Definition: NegList.cs:63
Definition: TestReplaceAndDefineMacros.cs:11
static LNode ParseSingle(this IParsingService parser, ICharSource text, string fileName, IMessageSink msgs=null, ParsingMode inputType=null, bool preserveComments=true)
Definition: IParsingService.cs:264
static string Convert(ArraySlice< byte > bytes, bool allowControlChars=true)
Encodes a byte array to a string with BAIS encoding, which preserves runs of ASCII characters unchang...
Definition: ByteArrayInString.cs:78
override T Front(int localCount)
Returns the "front" item in a FVList/FWList associated with this block (or back item of a VList) wher...
Definition: VListBlockArray.cs:130
static new readonly Symbol TriviaCsPPRawText
"%C#PPRawText" - C#PPRawText("#stuff") - Raw text that is guaranteed to be preceded by a newline and ...
Definition: EcsCodeSymbols.cs:29
static readonly Symbol Event
e.g. #event(EventHandler, Click, { }) <=> event EventHandler Click { }
Definition: CodeSymbols.cs:173
See PropagateVariables for more information.
Definition: ThreadEx.cs:178
bool IsOrdered
Returns true for "normal" numbers, false for ones that aren't necessarily comparable (notably complex...
Definition: Interfaces.cs:131
BDictionary(Func< K, K, int > compareKeys)
Definition: BDictionary.cs:64
void Add(byte[] key, TValue value)
Adds the specified key-value pair to the trie, throwing an exception if the key is already present.
Definition: CPByteTrie.cs:23
static readonly Symbol Goto
e.g. #goto(label) <=> goto label;
Definition: CodeSymbols.cs:146
Definition: MacroProcessorTests.cs:124
@ As
If there is a mismatch, return null instead of throwing InvalidCastException
static void MuAddEmpty(WListProtected< T > w, int count, int newBlockSizeLimit)
Adds empty item(s) to the front of the list.
Definition: VListBlock.cs:905
static readonly IMessageSink LogExceptionErrorSink
Throws LogException when it receives an error. Non-errors are sent to MessageSink....
Definition: BaseLexer.cs:126
virtual LNodeList Attrs
Returns the attribute list for this node.
Definition: LNode.cs:255
new void CopyTo(T[] array, int arrayIndex)
Copies the elements of the collection to an Array, starting at a particular array index.
Definition: WListBase.cs:372
void Resize(int newSize)
Definition: InternalList.cs:139
IListSource< LNode > Parse(IListSource< Token > input, ISourceFile file, IMessageSink msgs, IParsingOptions options)
Parses a token tree, such as one that came from a token literal.
Definition: Les3LanguageService.cs:83
bool Add(T item)
Adds the specified item to the set if it is not present.
Definition: MSet.cs:151
static ? int NextLowerIndex< T >(this ISparseListSource< T > list, int? index)
Gets the next lower index that is not classified as an empty space, or null if there are no non-blank...
Definition: ISparseList.cs:99
An exception thrown by dictionary objects when they are asked to "add" a key-value pair that already ...
Definition: Exceptions.cs:111
virtual bool LLDelete(int i, bool adjustIndexesAfterI)
Deletes the child _children[i], shifting all entries afterward to the left, and decrements _childCoun...
Definition: AListInnerBase.cs:511
abstract LNode LAType()
Returns the data type of LA(k)
LNodeList ProcessSynchronously(LNodeList stmts)
Processes a list of nodes directly on the current thread.
Definition: MacroProcessor.cs:216
Provides a weak reference to an object of the given type to be used in a WeakDictionary along with th...
Definition: WeakKeyComparer.cs:96
T Peek()
Gets the largest item from the heap (or the smallest item, if this is a MinHeap).
Definition: Heap.cs:201
static readonly Symbol NullCoalesce
"'??": a ?? b <=> ԉ۪??`(a, b)
Definition: CodeSymbols.cs:111
override LNode LAType()
Returns the data type of LA(k)
Definition: IntStreamCodeGenHelper.cs:208
static readonly Symbol Class
e.g. #class(Foo, #(IFoo), { }); <=> class Foo : IFoo { }
Definition: CodeSymbols.cs:162
T Pop()
Removes the front item (at index 0) from the list and returns it.
Definition: FVList.cs:206
bool ProcessArguments(BMultiMap< string, string > options, bool warnAboutUnknownOptions, IList< string > inputFiles=null)
Processes all standard command-line arguments from KnownOptions, except –help.
Definition: Compiler.cs:226
BDictionary< K, V > Clone()
Definition: MacroTesterBase.cs:14
static ulong PutInRange(this ulong n, ulong min, ulong max)
Returns num clamped to the range min and max.
Definition: GRange.out.cs:82
bool AllowChangeParentheses
Indicates that it is preferable to add (or remove) parenthesis to produce good-looking output,...
Definition: ILNodePrinterOptions.cs:19
Extends the "enumerator" concept to allow backward enumeration.
Definition: New enumerators.cs:19
All nodes in a Loyc syntax tree share this base class.
Definition: LNode.cs:57
static readonly Symbol Namespace
e.g. #namespace(NS, @``, { }); <=> namespace NS { }
Definition: CodeSymbols.cs:169
Internal implementation class. Shared code of non-sparse AList leaf nodes.
Definition: AListLeaf.cs:21
int Max
Returns the maximum valid index, which is Min + OriginalList.Count - 1.
Definition: NegList.cs:76
LiteralNode Literal(Token t, ILiteralParser parser)
Creates a literal from a Token. If it's an "ordinary" token, this function simply calls LiteralFromVa...
Definition: LNodeFactory.cs:158
static IReadOnlyCollection< T > AsReadOnly< T >(this ICollection< T > c)
Treats any ICollection{T} object to IReadOnlyCollection{T}.
Definition: CollectionAsSource.cs:15
Represents a set of characters (e.g. 'A'..'Z' | 'a'..'z' | '_'), or a set of token IDs.
Definition: IntSet.cs:19
@ BracketFlag
Openers and closers all have this bit set.
Internal implementation class. Leaf node of BList<T> and BDictionary<K,V>.
Definition: BListLeaf.cs:11
A bijection is a one-to-one function and its inverse. It is implemented with a pair of dictionaries,...
Definition: Bijection.cs:36
bool OmitSpaceTrivia
When this flag is set, space trivia attributes are ignored (e.g. CodeSymbols.TriviaSpaceAfter).
Definition: EcsNodePrinter.cs:1336
A lexer wrapper that saves whitespace tokens into a list (TriviaList).
Definition: TriviaSaver.cs:15
@ NonAscii
Escape ALL characters with codes above 127 as \xNN or \uNNNN
static readonly Symbol SubAssign
"'-=" subtract-and-set operator
Definition: CodeSymbols.cs:124
Combines ICollectionEx<T> with INotifyListChanging<T, ICollection<T>> and INotifyListChanged<T,...
Definition: Extended interfaces.cs:31
override Pred Clone()
Deep-clones a predicate tree. Terminal sets and Nodes referenced by the tree are not cloned; the clon...
Definition: Predicates.cs:831
static readonly Symbol Neq
"!=" Inequality test operator
Definition: CodeSymbols.cs:48
virtual LNode LA(int k)
Generates code to read LA(k).
Definition: CodeGenHelperBase.cs:269
IEnumerator< LNode > Run(IEnumerator< LNode > nodes)
Attaches trivia to the input nodes provided.
Definition: AbstractTriviaInjector.cs:194
bool PriorIsOwned
Returns true if this block has exclusive ownership of mutable items in the prior block....
Definition: VListBlock.cs:288
virtual LNode ApiCall(Symbol apiName, IEnumerable< LNode > args, bool isStatic=false)
Returns an LNode representing a call to the specified LLLPG API. For example, if the user used a "inp...
Definition: CodeGenHelperBase.cs:477
static void Verify(bool condition)
Same as Assert(), except that the condition expression can have side-effects because it is evaluated ...
Definition: AListNode.cs:248
Maybe< Token > NextToken()
Scans the next token and returns information about it.
Definition: TokenListAsLexer.cs:28
static ListSlice< T > SortLowestK< T >(this IList< T > list, int k)
Uses a partial quicksort, known as "quickselect", to find and sort the lowest k elements in a list.
Definition: ListExt.cs:338
UString is a slice of a string. It is a wrapper around string that provides a IBRange<T> of 21-bit UC...
Definition: UString.cs:56
virtual IPGTerminalSet Optimize(IPGTerminalSet set, IPGTerminalSet dontcare)
Simplifies the specified set, if possible, so that GenerateTest() can generate simpler code for an if...
Definition: CodeGenHelperBase.cs:127
The recommended base class for lexers generated by LLLPG, when not using the inputSource option.
Definition: BaseLexer.cs:61
A set of symbols.
Definition: SymbolSet.cs:23
A fast, simple timer class with a more convenient interface than System.Diagnostics....
Definition: SimpleTimer.cs:24
static LNodeList AsList(this LNode block, Symbol listIdentifier)
Interprets a node as a list by returning block.Args if block.Calls(listIdentifier),...
ListChangingHandler< T, TCollection > ListChanged
Occurs when the collection associated with this interface has changed.
Definition: INotifyListChanged.cs:49
@ Newline
Represents a forced-break (newline) character.
static readonly Symbol New
"'new": new Foo(x) { a } <=> <tt>'new(Foo(x), a); new[] { ... } <=> <tt>'new(<tt>[](),...
Definition: CodeSymbols.cs:101
Map< K, V > Union(MapOrMMap< K, V > other, bool replaceWithValuesFromOther)
Returns a copy of the current map with the specified items added.
Definition: Map.cs:315
static new readonly Symbol PtrArrow
"'->": a->b <=> ԉ۪->`(a, b)
Definition: EcsCodeSymbols.cs:16
static bool True< T >(T value)
Returns true. This method has no effect; it is used to do an action in a conditional expression.
Definition: G.cs:137
delegate void ListChangingHandler< T, TSender >(TSender sender, ListChangeInfo< T > args)
Represents the method that handles the INotifyListChanging<T, TSender>.ListChanging event.
static readonly Symbol Is
"'is": @'is(x,string) <=> x is string, @'is(x,#var(Foo,v),#(y,z)) <=> x is Foo v(y,...
Definition: CodeSymbols.cs:109
bool IsProperSubsetOf(ISet< T > other, int myExactCount)
Returns true if all items in this set are present in the other set, and the other set has at least on...
Definition: InternalSet.cs:1548
Represents a (contiguous) region of text in a source file.
Definition: ISourceRange.cs:9
WhitespaceTag.Value can be used as the Token.Value of whitespace tokens, to make whitespace easy to f...
Definition: Token.cs:583
Represents a write-only array.
Definition: Sink interfaces.cs:23
int Count
Returns the total number of items in the list (same as OriginalList.Count).
Definition: NegListSource.cs:72
An immutable set of type SetT with elements of type T.
Definition: ISetImm.cs:42
static int Register(IParsingService service, IEnumerable< string > fileExtensions=null)
Registers a parsing service.
Definition: IParsingService.cs:142
VListBlock implements the core functionality of FVList, VList, FWList and WList. It is not intended t...
Definition: VListBlock.cs:176
Adapter: reversed view of IListSource<T> returned from LinqToLists.Reverse<T>.
Definition: ReversedListSource.cs:18
static bool operator==(VList< T > lhs, VList< T > rhs)
Returns whether the two list references are the same. Does not compare the contents of the lists.
Definition: VList.cs:126
abstract T Front(int localCount)
Returns the "front" item in a FVList/FWList associated with this block (or back item of a VList) wher...
abstract LNode GenerateMatchExpr(IPGTerminalSet set, bool savingResult, bool recognizerMode)
Generate code to match a set, e.g. MatchRange('a', 'z'); or MatchExcept(' ', '\r'); }....
TValue this[byte[] key
Finds the specified key and returns its associated value. If the key did not exist,...
Definition: CPByteTrie.cs:142
TokenType Type
The category of the token (integer, keyword, etc.) used as the primary value for identifying the toke...
Definition: Token.cs:598
@ PriorityNormal
Normal priority (this is the default and does not need to be specified.)
Definition: Predicates.cs:844
static bool AddIfNotPresent< K, V >(this IDictionaryEx< K, V > dict, K key, V value)
Adds a key/value pair to the dictionary if the key is not present. If the key is already present,...
Definition: IDictionaryEx.cs:127
static bool operator!=(FVList< T > lhs, FVList< T > rhs)
Returns whether the two list references are different. Does not compare the contents of the lists.
Definition: FVList.cs:129
bool QuoteUnprintableLiterals
When the printer encounters an unprintable literal, it calls Value.ToString(). When this flag is set,...
Definition: Les2Printer.cs:711
UString Right(int length)
Returns the rightmost length code units of the string, or fewer if the string length is less than len...
Definition: UString.cs:386
static LNode IncludingTriviaFrom(this LNode node, LNode otherNode)
Finds trivia attributes attached directly to otherNode, and returns a new version of node with these ...
Definition: LNodeExt.cs:143
@ HasEscapes
While unescaping, a backslash was encountered.
ListSlice(IList< T > list, int start, int count=int.MaxValue)
Initializes a slice.
Definition: ListSlice.cs:56
BDictionary(BDictionary< K, V > items, bool keepListChangingHandlers)
Definition: BDictionary.cs:101
static int Log2Floor(uint x)
Definition: G.cs:314
static FVList< T > FindNextBlock(ref FVList< T > subList, FVList< T > list, out int localCountOfSubList)
Finds the block that comes before 'subList' in the direction of the larger list, 'list'.
Definition: VListBlock.cs:598
bool IsProperSubsetOf(InvertibleSet< T > other)
Definition: InvertibleSet.cs:142
static Exception ThrowsAny(Type expectedExceptionType, Action code, string message, params object[] args)
Verifies that a delegate throws a particular exception when called.
Definition: MiniTest.cs:539
Symbol GetGlobalOrCreateHere(string name)
Gets a symbol from the global pool, if it exists there already; otherwise, creates a Symbol in this p...
Definition: Symbol.cs:341
@ DoubleQuotes
Escape double quotes as "
Compares objects of the given type or WeakKeyReferences to them for equality based on the given compa...
Definition: WeakKeyComparer.cs:17
T PositiveInfinity
Returns positive infinity, or MaxValue for types that cannot represent infinity.
Definition: Interfaces.cs:102
ThreadLocalVariable(T initialValue, T fallbackValue, Func< T, T > propagator)
Constructs a ThreadLocalVariable.
Definition: ThreadEx.cs:497
T[] ToArray()
Returns the WList converted to an array.
Definition: WList.cs:273
static readonly Symbol DivAssign
"'/=" divide-and-set operator
Definition: CodeSymbols.cs:122
bool TryAdd(string key, ref TValue value)
Adds the specified key-value pair only if the specified key is not already present in the trie.
Definition: CPStringTrie.cs:47
Additional extension methods for IEnumerable<T>, IReadOnlyCollection<T>, and ICollection<T>,...
Definition: BufferedSequence.cs:22
@ Unrecognized
While unescaping, an unrecognized escape was encountered .
void RemoveAll(AListNode< K, T > node)
Called when all children are being removed from a node (leaf or inner) because the node is being spli...
Definition: AListNodeObserver.cs:108
Chars
Based on these flags, StartToken() and WriteToken() ensure that two adjacent tokens aren't treated li...
Definition: Les3Printer.cs:159
override T RGet(int index, int localCount)
Gets an item at distance 'index' from the back (beginning of a VList)
Definition: VListBlockArray.cs:114
FVList< T > SmartAdd(T item, FVList< T > original)
Adds the specified item to the list, or original.WithoutFirst(original.Count - Count - 1) if doing so...
Definition: FVList.cs:299
static bool IsInRange(this uint num, uint lo, uint hi)
Returns true if num is between lo and hi.
Definition: GRange.out.cs:44
bool PreferPlainCSharp
Prefers plain C# syntax for certain other things (not covered by the other options),...
Definition: EcsNodePrinter.cs:1364
Represents a pool of objects in which an object is automatically created when requested by its key.
Definition: IAutoCreatePool.cs:15
bool TryAdd(int key, TValue value)
Adds the specified key-value pair only if the specified key is not already present in the trie.
Definition: CPIntTrie.cs:294
static MessageSinkWithContext< TContext > WithContext< TContext >(IMessageSink< TContext > target, TContext context, string messagePrefix=null)
Creates a message sink with a default context to be used when Write is called with context: null,...
Definition: MessageSink.out.cs:336
FVList< T > ToFVList()
Returns this list as a FVList; if this is a WList, the order of the elements is reversed at the same ...
Definition: WListBase.cs:324
IRange< char > IListSource< char >. Slice(int start, int count)
Returns a substring from the character source. If some of the requested characters are past the end o...
Definition: UString.cs:299
static string NameWithGenericArgs(this Type type)
Returns the type with generic parameters in C# style, e.g. typeof(List<List<string>>....
Definition: Extensions.cs:20
bool SetEquals(ISet< T > other)
Definition: MSet.cs:292
void PriorityChanged(int index)
Notifies the heap that the priority of the item at the specified index has changed....
Definition: Heap.cs:117
A reference to a FVList, a so-called persistent list data structure.
Definition: FVList.cs:41
static char Last(this StringBuilder str)
Returns the last character of the string
Definition: StringBuilderExt.cs:19
static Pair< UString, UString > SplitAt(this string s, char delimiter)
Gets the substrings to the left and right of a dividing character.
Definition: StringExt.cs:44
IEnumerable< ValueList > Values
Gets a list of collections of ValueList in this object.
Definition: BMultiMap.cs:468
Pred CodeToTerminalPred(LNode expr, ref string errorMsg)
Creates a terminal predicate from a code expression.
delegate void WriteMessageFn(Severity type, object context, string format, params object[] args)
This is the method signature of IMessageSink.Write(). You can convert from one of these delegates to ...
Maybe< Token > NextToken()
Scans the next token and returns information about it.
static StringBuilder Trim(this StringBuilder sb, params char[] trimChars)
Removes all leading and trailing occurrences of the specified set of characters from the StringBuilde...
Definition: StringBuilderExt.cs:66
bool AutoCleanup()
Periodically removes entries with garbage-collected values from the dictionary
Definition: WeakValueDictionary.cs:38
Data returned from IMacroContext.AllKnownMacros
Definition: MacroAttributes.cs:148
LNodeList ToLNodes()
Converts this list of Token to a list of LNode.
Definition: TokenTree.cs:110
static ListSlice< T > SortLowestKStable< T >(this IList< T > list, int k)
A stable version of SortLowestK<T>(IList<T>,int). This means that when k>1 and adjacent results at th...
Definition: ListExt.cs:362
static bool TryParseFloatParts(ref UString source, int radix, out bool negative, out ulong mantissa, out int exponentBaseR, out int exponentBase2, out int exponentBase10, out int numDigits, ParseNumberFlag flags=0)
Low-level method that identifies the parts of a float literal of arbitrary base (typically base 2,...
Definition: ParseHelpers.cs:435
static readonly Symbol TwoDimensionalArray
int[,] <=> @'of(ԉ۪[,]`, int)
Definition: CodeSymbols.cs:74
Definition: InternalDList.cs:758
Returned by PushCurrent(IMessageSink).
Definition: MessageSink.out.cs:59
IEnumerable< int > IndexesOf(T item)
Returns a sequence of integers that represent the locations where a given item appears in the list.
Definition: AListBase.cs:602
Provides the Sqrt operation and its inverse, Square.
Definition: Interfaces.cs:230
Standard parsing modes used with IParsingService and ILNodePrinterOptions.
Definition: ParsingMode.cs:10
int Count
Returns the total number of items in the list (same as OriginalList.Count).
Definition: NegList.cs:72
bool SetEquals(IEnumerable< T > other)
Definition: Set.cs:173
static ? int FinalIndexWhere< T >(this IReadOnlyList< T > source, Func< T, bool > pred)
Gets the highest index at which a condition is true, or null if nowhere.
Definition: IListSource.cs:155
void Add(V item)
Adds a new item associated with the key that this object represents. Allows duplicate values.
Definition: BMultiMap.cs:299
Marks a method that is to be called after each test in a test fixture.
Definition: MiniTest.cs:144
static readonly Symbol ExpAssign
"'**=" raise-to-exponent-and-set operator
Definition: CodeSymbols.cs:129
IntSet EquivalentInverted()
Computes the equivalent inverted set, e.g. if the set is 'b'..'y', the equivalent inverted set is ~(i...
Definition: IntSet.cs:367
MessageSinkWithContext(IMessageSink< TContext > target, TContext defaultContext, string messagePrefix=null, bool scrubPrefix=true)
Initializes the wrapper.
Definition: WrapperSinks.cs:202
void Write(Severity level, TContext context, string format)
Writes a message to the target that this object represents.
Definition: WrapperSinks.cs:136
int AddRange(IEnumerable< KeyValuePair< K, V >> e, DictEditMode mode)
Merges the contents of the specified sequence into this map.
Definition: BDictionary.cs:289
This interface is to be used by read-only sequences that nevertheless wish to be compatible with APIs...
Definition: Disambiguation interfaces.cs:55
ILexer< Token > Tokenize(ICharSource text, string fileName, IMessageSink msgs, IParsingOptions options)
Returns a lexer that is configured to begin reading the specified file.
Definition: EcsLanguageService.cs:67
abstract IEnumerator< Token > MakeDedentToken(Token tokenBeforeNewline, ref Maybe< Token > tokenAfterNewline)
Returns token(s) to represent un-indentation.
@ MatchIdentifier
If this flag is present, the macro can match a plain identifier. By default, only calls can be treate...
static Maybe< V > GetAndRemove< K, V >(this IDictionary< K, V > dict, K key)
Default implementation of IDictionaryEx<K, V>.GetAndRemove. Gets the value associated with the specif...
Definition: DictionaryExt.cs:183
static LNode TokenToLNode(Token token, ISourceFile file)
Converts a Token to a LNode.
Definition: TokenTree.cs:152
virtual void Error(int lookaheadIndex, string message)
This method is called to handle errors that occur during lexing.
Definition: BaseLexer.cs:591
static Either< L, R > NewLeft(L value)
Simply calls the constructor. This method exists to make it possible to construct an Either when both...
static void Expect(bool condition)
Calls Fail() if condition is false.
Definition: MiniTest.cs:527
Represents a read-only indexed list in which parts of the index space may be unused or "clear".
Definition: ISparseList.cs:43
override LNode WithName(Symbol name)
Creates a node with a new value for Name.
Definition: AbstractNodes.cs:97
int IndentLevel
Indentation level of the current line. This is updated after scanning the first whitespaces on a new ...
Definition: ILexer.cs:26
void EnterReadLock()
Acquires the lock to protect read access to a shared resource.
Definition: ThreadEx.cs:351
LNode SetType
Specifies the data type for large terminal sets (default: HashSet<T>).
Definition: GeneralCodeGenHelper.cs:43
SymbolPool Pool
Gets the SymbolPool in which this Symbol was created.
Definition: Symbol.cs:72
virtual bool IndentChangedUnexpectedly(Token tokenBeforeNewline, ref Maybe< Token > tokenAfterNewline, ref int deltaIndent)
A method that is called when the indent level changed without a corresponding indent trigger.
Definition: IndentTokenGenerator.cs:129
Contains math code and data types for processing geometry (points, lines, polygons,...
Definition: IPoint.cs:7
static readonly IMessageSink LogExceptionErrorSink
Throws LogException when it receives an error. Non-errors are sent to MessageSink....
Definition: BaseParser.cs:40
A compact patricia trie that uses byte arrays as keys.
Definition: CPByteTrie.cs:12
IPGTerminalSet Optimize(IPGTerminalSet set, IPGTerminalSet dontcare)
Simplifies the specified set, if possible, so that GenerateTest() can generate simpler code for an if...
Represents the essence of a dictionary, which returns a value given a key.
Definition: Other interfaces.cs:41
int AddRange(MMap< K, V > data, bool replaceIfPresent=true)
Merges the contents of the specified map into this map.
Definition: MMap.cs:143
static readonly Symbol Div
"/" Division
Definition: CodeSymbols.cs:30
static readonly Symbol GotoCase
e.g. #gotoCase(expr) <=> goto case expr;
Definition: CodeSymbols.cs:147
void Swap(AList< T > other)
Swaps the contents of two AList<T>s in O(1) time.
Definition: AList.cs:300
override Pred CodeToTerminalPred(LNode expr, ref string errorMsg)
Creates a terminal predicate from a code expression.
Definition: GeneralCodeGenHelper.cs:93
bool CanMixWith(Precedence context)
Returns true if an operator with this precedence is miscible without parenthesis with the specified o...
Definition: Precedence.cs:293
LNode GetListType(LNode type)
Gets the list type for elements of the specified type (e.g. List<type>)
static TokenType GetOperatorTokenType(UString op)
Under the assumption that op is a sequence of punctuation marks that forms a legal operator,...
Definition: Les3.cs:124
T Shr(T a, int amount)
Shifts 'a' right by the specified number of bits.
Symbol TypeMarker
Gets the type marker stored in this token, if this token was initialized with one of the constructors...
Definition: Token.cs:330
Provides the value of "one" for type T.
Definition: Interfaces.cs:85
Base class for visitors that can replace predicates entirely.
Definition: PredVisitor.cs:46
WList is the mutable variant of the VList data structure.
Definition: WList.cs:32
A class filled with methods for checking whether a node has the correct LNode.Name and structure....
Definition: EcsValidators.cs:21
A helper class used by LLLPG for backtracking.
Definition: BaseParser.cs:284
T GetAt(int index)
Gets an item from a FWList or WList at the specified index.
Definition: WListBase.cs:123
bool SetEquals(IEnumerable< T > other, IEqualityComparer< T > comparer, int myExactCount)
Returns true if this set and the other set have the same items.
Definition: InternalSet.cs:1629
static List< string > WordWrap(string paragraph, int lineWidth)
Breaks a paragraph into lines using a simple word-wrapping algorithm.
Definition: G.cs:479
An immutable set that can be inverted. For example, an InvertibleSet<int> could contain "everything e...
Definition: InvertibleSet.cs:30
bool Remove(int key)
Removes the specified key and associated value, returning true if the entry was found and removed.
Definition: CPIntTrie.cs:430
T Pop()
Removes the last item (at index Count-1) from the list and returns it.
Definition: VList.cs:235
bool IsSet(int index)
Determines whether a value exists at the specified index.
Definition: ListSourceAsSparse.cs:48
VList< T > SmartSelectMany(Func< T, IReadOnlyList< T >> map)
Maps a list to another list by concatenating the outputs of a mapping function.
Definition: VList.cs:608
int InputPosition
Current position of the next token to be parsed.
Definition: BaseParser.cs:80
int GetImmutableCount()
Diagnostic method. Returns the number of elements of the list that are located in immutable nodes,...
Definition: AListBase.cs:1104
Definition: Les3Printer.cs:18
override void MuClear(int localCountWithMutables)
Clears all mutable items in this chain, and clears the mutable flag. If this block owns mutable items...
Definition: VListBlockArray.cs:230
virtual int BaseCostForSwitch
Used to help decide whether a "switch" or an if-else chain will be used for prediction....
Definition: CodeGenHelperBase.cs:297
static int MuAllocBlock(WListProtected< T > w, int newBlockSizeLimit)
Used by MuAddEmpty to allocate an empty mutable block.
Definition: VListBlock.cs:955
virtual void Done()
LLParserGenerator calls this method to notify the snippet generator that code generation is complete.
Definition: CodeGenHelperBase.cs:142
Maybe< Token > _current
The token that will be returned from the Current property.
Definition: BaseILexer.cs:59
UString Find(uchar what, bool ignoreCase=false)
Finds the specified UCS-4 character.
Definition: UString.cs:402
static LNode LLLPG_parser(LNode node, IMacroContext context)
Helper macro that translates parser in LLLPG(parser, {...}) into a GeneralCodeGenHelper object.
Definition: Macros.cs:107
SeverityMessageFilter(IMessageSink< object > target, Severity minSeverity, bool includeDetails=true)
Definition: WrapperSinks.cs:71
int FirstIndexOf(K key)
Finds the lowest index of an item with the specified key.
Definition: BMultiMap.cs:151
static readonly Symbol Try
e.g. #try({...}, #catch(<tt>, @, {...})); <=> try {...} catch {...}
Definition: CodeSymbols.cs:157
Interface for reading the size of a 2D object.
Definition: IRectangle.cs:11
int IncrementTempCounter()
Gets the next number to use as a suffix for temporary variables, then increments it.
Internal implementation class. Leaf node of SparseAList<T>.
Definition: SparseAListLeaf.cs:19
The Assert class contains a collection of static methods that mirror the most common assertions used ...
Definition: MiniTest.cs:245
LNode ErrorBranch(IPGTerminalSet covered, int laIndex)
Generates code for the error branch of prediction.
Func< MatchType, string > TokenTypeToString
Converts from MatchType (usually integer) to string (used in error messages).
Definition: ParserSource.cs:51
abstract Maybe< Token > NextToken()
Returns the next (postprocessed) token. This method should set the _current field to the returned val...
bool SpacesBetweenAppendedStatements
Whether to add a space between multiple statements printed on one line (initial value: true).
Definition: Les3PrinterOptions.cs:85
static SavedThreadLocal< LocalizerDelegate > UseResourceManager(ResourceManager manager, CultureInfo culture=null, Func< string, string > resxNameCalculator=null)
Uses a standard ResourceManager object to obtain translations.
Definition: Localize.cs:263
Helper class invoked just after StageTwoParser. Its job is to create variables referenced by labels (...
Definition: AutoValueSaverVisitor.cs:22
static readonly Symbol Ref
"#ref": ref int x <=> [#ref] #var(#int, x)
Definition: CodeSymbols.cs:104
static SavedValue< IMessageSink > SetDefault(IMessageSink sink)
Used to change the MessageSink.Default property temporarily.
Definition: MessageSink.out.cs:50
Token(int type, int startIndex, UString sourceText, NodeStyle style, Symbol typeMarker, int substringStart, int substringEnd)
Initializes an "uninterpreted literal" token designed to store two parts of a literal without allocat...
Definition: Token.cs:166
Contains general-purpose math algorithms beyond what is provided in the .NET BCL (Base Class Library)...
Definition: Interfaces.cs:17
Represents a set of characters (e.g. 'A'..'Z' | 'a'..'z' | '_'), or a set of integers,...
Definition: PGIntSet.cs:23
Parses Enhanced C# code into a sequence of Loyc trees (LNode), one per top-level statement.
Definition: EcsParser.cs:28
A central class for keeping track of literal parsers and literal printers.
Definition: LiteralHandlerTable.cs:13
Represents a type that holds a single value of one of two types (L or R).
Definition: MiscInterfaces.cs:56
BDictionary(int maxLeafSize, int maxInnerSize)
Definition: BDictionary.cs:61
override string ToString()
Reconstructs a string that represents the token, if possible. Does not work for whitespace and commen...
IListSource< T > OldItems
This member may provide a list of old items that are being removed or replaced in the collection....
Definition: ListChangeInfo.cs:96
int IndexOfAny(T item)
Returns an index at which the specified item can be found.
Definition: AListIndexer.cs:172
This defines a Ring with the operations +,*
Definition: Interfaces.cs:292
void AddAll(AListNode< K, T > node)
Called when all children are being added to a node (leaf or inner). Notifications are not sent for in...
Definition: AListIndexer.cs:135
NewlineContext
Used to help keep track of where newline trivia (and single- line comments ending in a newline) are p...
Definition: Les3Printer.cs:181
Provides the standard set of bitwise operators.
Definition: Interfaces.cs:168
Provides operations available on floating-point types (float and double), including trigonometry and ...
Definition: Interfaces.cs:381
override Maybe< Token > NextToken()
Returns the next (postprocessed) token. This method should set the _current field to the returned val...
Definition: IndentTokenGenerator.cs:202
abstract bool IsNullable
Returns true if this predicate can match an empty input.
Definition: Predicates.cs:81
static readonly Symbol NotEq
"!=" Inequality test operator
Definition: CodeSymbols.cs:46
string Example(IPGTerminalSet set)
Returns an example of an item in the set. If the example is a character, it should be surrounded by s...
IReadOnlyDictionary< Symbol, Func< UString, Symbol, Either< object, LogMessage > > > Parsers
A table of parsers indexed by type marker Symbol. The AddParser method is used to add an item to this...
Definition: LiteralHandlerTable.cs:28
IListSource< LNode > RemainingNodes
Gets a list of the remaining nodes (arguments/statements or attributes) after this point in the code ...
Definition: IMacroContext.cs:81
static IEnumerable< Pair< T, T > > AdjacentPairs< T >(this IEnumerable< T > list)
Returns all adjacent pairs (e.g. for the list {1,2,3}, returns {(1,2),(2,3)})
Definition: EnumerableExt.cs:388
Interface for reading the coordinates of a 2D point.
Definition: IPoint.cs:11
int ExprComplexity()
Returns the "complexity" of the set.
Definition: PGIntSet.cs:138
virtual int GetRelativeCostForSwitch(IPGTerminalSet set)
Used to help decide whether a "switch" or an if statement will be used to handle a prediction tree,...
Definition: CodeGenHelperBase.cs:307
int ManagedThreadId
Gets a unique identifier for the current managed thread.
Definition: ThreadEx.cs:225
Base class for implementing a visitor that examines a tree of LLLPG Predicates.
Definition: PredVisitor.cs:10
bool PreferCustomLiterals
If this flag is true, all literals except plain strings and true/false/null are stored as CustomLiter...
Definition: Les3.cs:36
This interface allows serializing LNode objects into the syntax of a particular programming language.
Definition: ILNodePrinter.cs:12
ushort _maxNodeSize
Maximum number of slots in this node
Definition: AListNode.cs:262
void CopyTo(T[] array, int arrayIndex)
Copies the elements of the collection to an Array, starting at a particular array index.
Helper classes for multithreaded code.
Definition: SavedThreadLocal.cs:4
override uint GetImmutableCount(bool excludeSparse)
Diagnostic method. See AListBase<K,T>.GetImmutableCount().
Definition: AListInnerBase.cs:609
void CopyTo(T[] array, int arrayIndex)
Copies the elements of the collection to an Array, starting at a particular array index.
Definition: VList.cs:395
int _left
number of bytes in the key that are not yet consumed
Definition: CPTrieMisc.cs:134
ParseNumberFlag
Flags that can be used with ParseHelpers.TryParseUInt(ref UString, out ulong, int,...
Definition: ParseHelpers.cs:611
Token(int type, int startIndex, int length, object value)
Definition: Token.cs:96
static SimpleCache< object >?? ObjectCache
Gets the cache used by Cache(object).
Definition: CG.cs:31
abstract SourceRange GetRange(Trivia trivia)
Gets the SourceRange for an element of trivia.
static ILexer< Token > Tokenize(this IParsingService parser, Stream stream, string fileName, IMessageSink msgs=null)
Parses a Stream.
Definition: IParsingService.cs:291
Interface for things that have a mutable Value property.
Definition: MiscInterfaces.cs:45
Adapter: Provides access to a section of an array.
Definition: ArraySlice.cs:22
void Cleanup()
Removes entries with garbage-collected values from the dictionary.
Definition: WeakValueDictionary.cs:47
static T MaxOrDefault< T >(this IEnumerable< T > list, Func< T, int > selector, T defaultValue=default(T))
Returns the item in the list that has the maximum value for some selector.
Definition: EnumerableExt.cs:305
A message sink that sends its messages to a list of other sinks.
Definition: WrapperSinks.cs:127
static VListBlock< T > Insert(VListBlock< T > self, int localCount, T item, int distanceFromFront)
Inserts a new item in a FVList where localCount is the number of items in the FVList's first block an...
Definition: VListBlock.cs:399
Holds information about the first set or kth set of a single arm of an Alts.
Definition: KthSet.cs:42
bool IsSupersetOf(IEnumerable< T > other, IEqualityComparer< T > thisComparer, int myMaxCount=int.MaxValue)
Returns true if all items in the other set are present in this set.
Definition: InternalSet.cs:1504
bool IsAttribute
Returns true if the current node is in the attribute list of its immediate parent.
Definition: IMacroContext.cs:85
IPGTerminalSet IntersectionCore(IPGTerminalSet other, bool subtract=false, bool subtractThis=false)
Computes the intersection of two sets.
char? DigitSeparator
Sets the "thousands" or other digit separator for numeric literals. Valid values are null (to disable...
Definition: Les3PrinterOptions.cs:136
Provides power, logarithm, raise-e-to-exponent (Exp) and logarithm-of-e (Log) operations.
Definition: Interfaces.cs:237
int LineStartAt
Index at which the current line started.
Definition: BaseLexer.cs:232
LNode CallRule(RuleRef rref, bool recognizerMode)
Generates code to call a rule based on rref.Rule.Name and rref.Params.
Return type of GetEnumerator().
Definition: ValueCollection.cs:136
static new readonly Symbol CsPPRawText
"#C#PPRawText" - Preprocessor raw text: always printed on separate line
Definition: EcsCodeSymbols.cs:31
int CountMemoryUsage(int sizeOfT)
Calculates the memory usage of this object, assuming a 32-bit architecture.
Definition: CPTrie.cs:241
LNode Basis
A node that contains the original code of the rule, or, if the rule was created programmatically,...
Definition: Rule.cs:25
@ ProcessChildrenBefore
The result is pre-processed before calling the macro, and not processed afterward (if the macro accep...
static bool ReplaceIfPresent< K, V >(this IDictionaryEx< K, V > dict, K key, V value)
Replaces an item in the map if the key was already present. If the key was not already present,...
Definition: IDictionaryEx.cs:157
WList< T > ToWList()
Returns this list as an WList.
Definition: VList.cs:278
int FindLowerBound(T item, out bool found)
Finds the lowest index of an item that is equal to or greater than the specified item.
Definition: BList.cs:345
@ AddOrThrow
The item will be added if its key is not already present, but KeyAlreadyExistsException or InvalidOpe...
static readonly Symbol Lock
e.g. #lock(obj, stmt); <=> lock(obj) stmt;
Definition: CodeSymbols.cs:152
Encapsulates algorithms for a max-heap, i.e. a priority queue that always knows the largest item and ...
Definition: Heap.cs:28
int Min
Returns the minimum valid index.
Definition: NegListSource.cs:74
T First
Gets the first item in the deque.
Definition: Queue interfaces.cs:74
@ AllowCommaDecimalPoint
Whether to treat comma as a decimal point when parsing a float. The dot '.' is always treated as a de...
void Skip()
Increments InputPosition. Called by LLLPG when prediction already verified the input (and caller does...
Definition: BaseLexer.cs:219
string InternalString
Returns the original string.
Definition: UString.cs:114
A multiplexer that is only created for ALists that have two or more attached intances of IAListTreeOb...
Definition: AListNodeObserver.cs:41
int RemoveAll(Predicate< T > match)
Removes all the elements that match the conditions defined by the specified predicate.
Definition: AListBase.cs:542
static bool TryParseUInt(ref UString s, out ulong result, int radix=10, ParseNumberFlag flags=0)
Tries to parse a string to an unsigned integer.
Definition: ParseHelpers.cs:314
T Floor(T value)
Gets the closest integer equal to or lower than the specified number.
IPGTerminalSet Empty
Returns the empty set.
Definition: IPGTerminalSet.cs:34
virtual uint GetRealItemCount()
For sparse lists: counts the number of non-sparse items.
Definition: AListNode.cs:294
@ HexLiteral
Used for a hexadecimal (base-16) literal like 0x1F.
Returned by PushPrinter(ILNodePrinter).
Definition: LNode.cs:546
static Repeated< T > Single< T >(T value)
Returns a helper object that stores one value, but acts like a read-only list of one item.
Definition: Repeated.cs:28
bool IsEnabled(Severity level)
Always returns true.
Definition: MessageHolder.cs:40
static StringBuilder PrintToHtmlCore(StringBuilder input, StringBuilder output=null, bool addPreCode=true, string newline="\n", string[] colorCodesToCssClasses=null)
Converts a StringBuilder with LesColorCode control codes to HTML with Pygments CSS class codes.
Definition: Les3PrettyPrinter.cs:226
void ProcessSynchronously(IReadOnlyList< InputOutput > sourceFiles, Action< InputOutput > onProcessed=null)
Processes source files one at a time (may be easier for debugging).
Definition: MacroProcessor.cs:227
TriviaSaver(ILexer< Token > lexer, int newlineTypeInt=int.MinValue)
Initializer.
Definition: TriviaSaver.cs:22
bool IsProperSubsetOf(MSet< T > other)
Definition: Set.cs:151
static int RemoveRange< K >(this ICollection< K > set, IEnumerable< K > list)
Removes data from a set (set.Remove(value) for all values in a sequence.)
Definition: ICollectionExt.cs:21
Definition: TestSequenceExpressionMacro.cs:12
MMap< K, V > With(K key, V value, bool replaceIfPresent=true)
Definition: MMap.cs:250
int UnionWith(InternalSet< T > other, IEqualityComparer< T > thisComparer, bool replaceIfPresent)
Definition: InternalSet.cs:1325
uchar TryDecodeAt(int index)
Returns the UCS code point that starts at the specified index.
Definition: UString.cs:226
static readonly Symbol ForwardPipeArrow
ԉ۪|>`(a, b) <=> a |> b
Definition: EcsCodeSymbols.cs:25
bool SetEquals(MSet< T > other)
Definition: MSet.cs:290
Provides operations available on all unsigned integer types (byte, uint, etc.); see also IMath<T>,...
Definition: Interfaces.cs:354
LexicalMacroAttribute(string syntax, string description, params string[] names)
LexicalMacroAttribute constuctor.
Definition: MacroAttributes.cs:60
string Description
Descriptive text for this test
Definition: MiniTest.cs:93
Helper interface for NestedEnumerator<Frame, T>.
Definition: NestedEnumerator.cs:167
The tail of a VList contains only one or two items. To improve efficiency slightly,...
Definition: VListBlockOfTwo.cs:15
static FormatterDelegate Formatter
String formatter method, which is string.Format by default
Definition: Localize.cs:219
I plan to use this attribute someday to gather all the localizable strings in an application....
Definition: Localize.cs:377
static LNodeList PlusTrailingTrivia(this LNodeList attrs, LNode trivia)
Adds additional trailing trivia to an attribute list.
Definition: LNodeExt.cs:103
bool Remap(ref int line, ref string fileName)
Remaps the specified line number, if a remapping has been created that applies to it.
Definition: LineRemapper.cs:117
A base class for read-only collections that wish to implement IList<T> and IListSource<T>....
Definition: ListSourceBase.cs:19
T Value
Please see the documentation of ScratchBuffer<T> itself.
Definition: ScratchBuffer.cs:67
static void That(bool condition)
Calls Fail() if condition is false.
Definition: MiniTest.cs:521
IListSource< LNode > Parse(ILexer< Token > input, IMessageSink msgs, IParsingOptions options)
If HasTokenizer is true, this method accepts a lexer returned by Tokenize() and begins parsing.
Definition: EcsLanguageService.cs:76
UString ShedExcessMemory(int maxExtra)
This method makes a copy of the string if this is a sufficiently small slice of a larger string.
Definition: UString.cs:480
Static methods that help to print literals, such as EscapeCStyle which escapes special characters wit...
Definition: PrintHelpers.cs:13
override void Error(int lookaheadIndex, string format)
This method is called to handle errors that occur during lexing.
Definition: LexerSource.cs:172
Provides operations available on all unsigned integer types (byte, uint, etc.); see also IMath<T>,...
Definition: Interfaces.cs:362
LNode InputSource
Specifies an object or class on which LLLPG APIs such as Match() and LA() should be called.
Definition: CodeGenHelperBase.cs:54
Definition: TestMatchMacro.cs:10
static readonly Symbol Explicit
e.g. [#explicit] #fn(#int32, [#operator] #cast, (Foo a,))
Definition: CodeSymbols.cs:183
Enumerates key-value pairs in a CPStringTrie.
Definition: CPStringTrie.cs:220
LNode GenerateSkip(bool savingResult)
Generate code to match any token.
This interface is meant to be implemented by read-only sequence types that originally implemented ICo...
Definition: Disambiguation interfaces.cs:15
void Write(Severity level, TContext context, string format)
Writes a message to the target that this object represents.
Definition: WrapperSinks.cs:45
TList List
Returns the underlying list that represents the binary heap.
Definition: Heap.cs:33
Sends all messages to System.Diagnostics.Trace.WriteLine(string).
Definition: BasicSinks.cs:129
IListSource< LNode > Parse(IListSource< Token > input, ISourceFile file, IMessageSink msgs, IParsingOptions options)
Parses a token tree, such as one that came from a token literal.
Definition: Les2LanguageService.cs:83
override string ToString()
Prints the character set using regex syntax, e.g. [$a-z] means "EOF or a to z", [^ \r] means "not \n ...
Definition: IntSet.cs:396
abstract override LNode WithName(Symbol name)
Creates a node with a new value for Name.
An sorted dictionary that allows multiple values to be associated with a single key.
Definition: BMultiMap.cs:46
static InternalList< T > AsInternalList< T >(this T[] array)
Converts an array to InternalList (exists to help infer type params)
Definition: InternalList.cs:450
static readonly Symbol SwitchStmt
e.g. #switch(n, { ... }); <=> switch(n) { ... }
Definition: CodeSymbols.cs:155
An exception that includes a "context" object as part of a LogMessage structure, typically used to in...
Definition: LogException.cs:14
static WordWrapCharType GetWordWrapCharType(int c)
This function controls the default character categorization used by overloads of WordWrap(string,...
Definition: G.cs:434
static readonly Symbol Dot
"'." binary dot operator, e.g. string.Join
Definition: CodeSymbols.cs:99
static readonly Symbol StackAlloc
#stackalloc for C# stackalloc (TODO)
Definition: CodeSymbols.cs:194
An exception thrown when a data structure is accessed (read or written) by one thread at the same tim...
Definition: Exceptions.cs:33
int FindLowerBound(ref T item)
Definition: BList.cs:357
Pred Match
Right-hand side of the gate, which is used for matching decisions.
Definition: Predicates.cs:767
ILexer< Token > Tokenize(ICharSource text, string fileName, IMessageSink msgs, IParsingOptions options)
Returns a lexer that is configured to begin reading the specified file.
Definition: Les3LanguageService.cs:57
Represents a range of single characters (e.g. 'A'..'Z').
Definition: IntSet.cs:573
int Offset
Returns the offset added to indexes in the original list, which equals -Min.
Definition: NegList.cs:56
static TokenType Type(this Token t)
Converts t.TypeInt to TokenType.
Definition: TokenType.cs:56
@ Expression
The node(s) should be printed as a normal expression, rather than using a special or statement notati...
object Value
The numeric or string value of the literal.
Definition: CustomLiteral.cs:23
static string Join(string separator, IEnumerator value)
Definition: StringExt.cs:122
virtual Symbol TypeMarker
If this node IsLiteral, gets the type marker associated with the literal. This property is null if th...
Definition: LNode.cs:353
static string Substring(this StringBuilder sb, int startIndex, int length)
Extracts a substring from the specified StringBuiler.
Definition: StringBuilderExt.cs:13
static bool StartsWith(this StringBuilder sb, UString what, bool ignoreCase=false)
Finds out whether the StringBuilder starts with the specified substring.
Definition: StringBuilderExt.cs:135
ThreadPriority Priority
Gets or sets a value indicating the scheduling priority of a thread.
Definition: ThreadEx.cs:233
int UnionWith(IEnumerable< T > other, IEqualityComparer< T > thisComparer, bool replaceIfPresent)
Adds the contents of 'other' to this set.
Definition: InternalSet.cs:1314
bool UseRedundantSemicolons
If true, a semicolon is used in addition to the usual newline to terminate each expression inside bra...
Definition: Les3PrinterOptions.cs:92
static void Sleep(int millisecondsTimeout)
Suspends the current thread for a specified time.
Definition: ThreadEx.cs:273
abstract void SetAt(uint index, T item, IAListTreeObserver< K, T > tob)
Sets an item at the specified sub-index.
static readonly Symbol For
e.g. #for(int i = 0, i < Count, i++, {...}); <=> for(int i = 0; i < Count; i++) {....
Definition: CodeSymbols.cs:139
A list of symbols that are very specific to C# or Enhanced C#. Note: many symbols Loyc....
Definition: EcsCodeSymbols.cs:14
Gathers a list of all one-token transitions starting from a single position. Also gathers any and-pre...
Definition: LLParserGenerator.cs:1007
@ PriorityOverrideMax
Highest priority. If this macro is ambiguous with another macro that doesn't have this flag,...
.NET Framework reflection doesn't offer complete type names for generic types such as "List<int>" (th...
Definition: MemoizedTypeName.cs:12
@ BackslashX
Use \xNN instead of \u00NN for characters 1-31 and 127-255
Les3PrettyPrinter(IMessageSink sink=null, ILNodePrinterOptions options=null)
Creates an instance of this class, which produces plain LES augmented with control codes.
Definition: Les3PrettyPrinter.cs:32
static readonly Symbol Interface
e.g. #interface(IB, #(IA), { }); <=> interface IB : IA { }
Definition: CodeSymbols.cs:168
bool NoCheckByDefault
If true, calls to Check() are suppressed when AndPred.CheckErrorMessage is null.
Definition: CodeGenHelperBase.cs:88
DList< Token > Flatten()
Converts a token tree back to a plain list.
Definition: TokenTree.cs:178
T TryPop(out bool isEmpty)
Removes the last item (at index Count-1) from the list and returns it.
Definition: VList.cs:214
static readonly Symbol Var
e.g. #var(#int32, x = 0, y = 1, z); #var(@``, x = 0) <=> var x = 0;
Definition: CodeSymbols.cs:172
static ListSourceAsSparse< T > AsSparse< T >(this IListSource< T > list)
Treats a non-sparse list as a read-only sparse list with no empty spaces.
Definition: ListSourceAsSparse.cs:13
int Do(AListOperation mode, ref T item)
Adds, removes, or replaces an item in the list.
Definition: BList.cs:177
Encapsulates an algorithm that consumes trivia (comments and newlines) from a list and adds it as tri...
Definition: StandardTriviaInjector.cs:59
bool SpaceInsideArgLists
Whether to print a space inside argument lists like f( ... ).
Definition: Les3PrinterOptions.cs:46
Thrown by Assert.Inconclusive().
Definition: MiniTest.cs:207
static StringBuilder Trim(this StringBuilder sb)
Removes all leading and trailing occurrences of spaces and tabs from the StringBuilder object.
Definition: StringBuilderExt.cs:63
virtual string ChooseGotoLabel()
Optional. If this predicate represents the matching code for a branch of an Alts and this code is rea...
Definition: Predicates.cs:197
static readonly ParsingMode File
Tells IParsingService.Parse to treat the input as a complete source file (this should be the default,...
Definition: ParsingMode.cs:39
static T Last< T >(this IReadOnlyList< T > list)
Gets the last item from the list (at list.Max).
Definition: LinqToLists.out.cs:49
static void PrintPlainCSharp(LNode node, StringBuilder target, IMessageSink sink, ParsingMode mode, ILNodePrinterOptions options=null)
Prints a node while avoiding syntax specific to Enhanced C#.
Definition: EcsNodePrinter.cs:114
Interface for reading the coordinates of a 3D point.
Definition: IPoint3.cs:10
@ AllowRefMismatch
Allow the cast even if NumberOfMethodsWithRefMismatch > 0
string[] ColorCodesToCssClasses
The lookup table of strings for control codes (LesColorCode values) to HTML classes,...
Definition: Les3PrettyPrinter.cs:28
Computes the "canonical" interpretation of a position for prediction purposes, so that ConsolidateDup...
Definition: LLParserGenerator.cs:914
string RangesToString(IList< int > ranges)
Converts a list of character ranges to a string, e.g. for input list {'*','*','a',...
Definition: BaseLexer.cs:662
virtual CallNode With(LNode target, LNodeList args)
Creates a CallNode with the same attributes and Range, but a different target and argument list....
Definition: LNode.cs:394
static readonly Symbol Lambda
"'=>" used to define an anonymous function
Definition: CodeSymbols.cs:115
Represents the set of values associated with a particular key in a BMultiMap<K,V> collection.
Definition: BMultiMap.cs:243
int Restart()
Restarts the timer from zero (unpausing it if it is paused), and returns the number of elapsed millis...
Definition: EzStopwatch.cs:83
static int IndexOf< T >(this IReadOnlyList< T > list, T item)
Determines the index of a specific value.
bool CanParse(Symbol typeMarker)
Returns true if there is a parser function for the given type marker. Never throws.
Definition: LiteralHandlerTable.cs:84
IMessageSink Sink
Returns the message sink, used for writing warnings and errors.
Definition: IMacroContext.cs:17
void EnterWriteLock(int threadID)
Acquires the lock to protect write access to a shared resource.
Definition: ThreadEx.cs:392
static MaxHeapInList< T > AsMaxHeap< T >(this IList< T > list, IComparer< T > compare=null, bool heapify=false)
Returns a MaxHeapInList wrapper object, which treats the list as a binary max-heap (priority queue)....
Definition: Heap.cs:316
ParserSource(IEnumerable< Token > list, Token eofToken, ISourceFile file, int startIndex=0)
<inheridoc>
Definition: ParserSource.cs:136
bool OmitComments
When this flag is set, comment trivia attributes are suppressed (e.g. CodeSymbols....
Definition: ILNodePrinterOptions.cs:23
static readonly Symbol Add
"+" Addition or unary +
Definition: CodeSymbols.cs:31
static bool IsNaturalOperatorToken(UString name)
Like IsNaturalOperator, but doesn't expect name[0] is apostrophe.
Definition: LesPrecedenceMap.cs:233
virtual int LaIndexToCharIndex(int lookaheadIndex)
Converts a lookahead token index to a character index (used for error reporting).
Definition: BaseParser.cs:115
Definition: IDictionaryEx.cs:187
Adapter: provides a view of an IList<T> in which the Count is the same, but the minimum index is not ...
Definition: NegList.cs:40
LineColumnFile IndexToLine(int charIndex)
Returns the position in a source file of the specified index.
Definition: BaseLexer.cs:695
bool? Greedy
Specifies whether the loop is greedy or nongreedy (ignored for non-loops). This flag is used in case ...
Definition: Predicates.cs:443
bool AutoFallbackMode
Returns true if this variable was created in "auto-fallback" mode, which means that setting the Value...
Definition: ThreadEx.cs:612
Maybe< LNode > ReplaceRecursive(Func< LNode, Maybe< LNode >> matcher, ReplaceOpt options=ReplaceOpt.Default)
Performs a recursive find-and-replace operation, by attempting to replace each child (among Attrs,...
Definition: LNode.cs:1006
bool AllowExtraParenthesis
Introduces extra parenthesis to express precedence, without using an empty attribute list [] to allow...
Definition: Les3PrinterOptions.cs:63
static object UnwrapOnce(object obj)
Unwraps an object if it was wrapped by GoInterface. This unwrapping is not recursive–if a wrapper is ...
Definition: GoInterface.cs:110
ParsingMode Mode
A global::Loyc.Syntax.ParsingMode value indicating which part of the language is being parsed (e....
Definition: IParsingOptions.cs:16
The intention of this interface is that a struct implementing it can be embedded inside a LiteralNode...
Definition: ILiteralValueProvider.cs:8
static LNode LllpgMacro(LNode node, IMacroContext context, Symbol expectedCodeGenMode, Func< LNode, IPGCodeGenHelper > makeCodeGenHelper, bool isDefault=false)
This method helps do the stage-one transform from LLLPG (config) {...} to run_LLLPG (helper literal) ...
Definition: Macros.cs:148
@ Compact
The node's children should have a compact notation. In LES3, the Julia-style list or call notation ha...
Represents a sparse list that allows insertion and removal of items and empty spaces....
Definition: ISparseList.cs:183
virtual object TriviaValue
Gets the value of Args[0].Value, if Args[0] exists; otherwise, returns NoValue.Value.
Definition: LNode.cs:583
static PushedPrinter PushPrinter(ILNodePrinter printer)
Helps you change printers temporarily. Usage in C#: using (LNode.PushPrinter(myPrinter)) { ....
Definition: LNode.cs:542
BaseParserForList(IEnumerator< Token > list, Token getEofToken, ISourceFile file, int startIndex=0)
<inheridoc>
Definition: BaseParserForList.cs:237
override CallNode WithArgs(LNodeList args)
Creates a Node with a new argument list. If this node is not a call, a new node is created using this...
Definition: AbstractNodes.cs:63
int OldStartingIndex
Returns Index. Exists for compatibility with NotifyCollectionChangedEventArgs.
Definition: ListChangeInfo.cs:63
bool IsBackground
Gets or sets a value indicating whether or not a thread is a background thread.
Definition: ThreadEx.cs:221
Map(IEqualityComparer< K > comparer)
Creates an empty map with the specified key comparer.
Definition: Map.cs:212
Definition: MacroProcessorTests.cs:121
Helper class for mapping from indexes to SourcePos and back.
Definition: IndexPositionMapper.cs:35
bool IsProperSubsetOf(ISet< T > other)
Definition: MSet.cs:274
Represents a read-only 3D rectangular prism.
Definition: IRectangle3.cs:41
Definition: LlpgTestLargerExamples.cs:10
A helper type for printer objects. Its primary purposes are to manage indentation and to "revoke" new...
Definition: PrinterState.cs:71
bool IsWhitespace
Returns true if Value == WhitespaceTag.Value.
Definition: Token.cs:360
virtual CallNode With(Symbol target, LNodeList args)
Creates a CallNode with the same attributes and Range, but a different target and argument list....
Definition: LNode.cs:412
virtual void CopyTo(T[] array, int arrayIndex)
Copies the elements of the collection to an Array, starting at a particular array index.
Definition: ListExBase.cs:75
override LNode GenerateTest(IPGTerminalSet set, LNode subject, Symbol setName)
Generates code to test whether a terminal is in the set.
Definition: IntStreamCodeGenHelper.cs:133
Set< T > Where(Predicate< T > match)
Returns a new set that contains only items that match the specified predicate (i.e....
Definition: Set.cs:315
override LiteralNode WithValue(object value)
Creates a new literal node with a different Value than the current literal node.
Definition: AbstractNodes.cs:25
bool IsSupersetOf(IEnumerable< T > other)
Returns true if all items in the other set are present in this set.
Definition: MSet.cs:260
static int SequenceHashCode< T >(this IEnumerable< T > list)
A companion to Enumerable.SequenceEqual<T> that computes a hashcode for a list.
Definition: EnumerableExt.cs:365
int RemoveAll(T item)
Removes all instances of the specified item.
Definition: BList.cs:159
bool ContainsKey(K key)
Finds out whether the specified key is present.
Definition: BMultiMap.cs:137
static MaxHeap< T > ToMaxHeap< T >(this IList< T > list, IComparer< T > compare=null, bool heapify=true)
Copies the list into a new object with the items arranged as a max-heap (priority queue)....
Definition: Heap.cs:330
static V TryGetValue< K, V >(this Dictionary< K, V > dict, K key, V defaultValue)
An alternate version TryGetValue that returns a default value if the key was not found in the diction...
Definition: DictionaryExt.cs:68
bool IsProperSupersetOf(MSet< T > other)
Definition: Set.cs:160
static bool IsInRangeExcludeHi(this ulong num, ulong lo, ulong hi)
Returns true if num is between lo and hi, excluding hi but not lo.
Definition: GRange.out.cs:74
static readonly Symbol Checked
e.g. #checked({ stmt; }); <=> checked { stmt; }
Definition: CodeSymbols.cs:149
ISourceFile Source
Returns the source file of which this range is a part. If this SourceRange represents a "synthetic" s...
Definition: SourceRange.cs:52
static ListSlice< T > TakeNowWhile< T >(this IList< T > list, Func< T, bool > predicate)
Returns a slice of the initial elements of the list that meet the provided criteria....
Definition: LinqToLists.out.cs:327
static V GetOrAdd< K, V >(this IDictionaryEx< K, V > dict, K key, V value)
Adds a key/value pair to the dictionary if the key is not already present, and returns the existing o...
Definition: IDictionaryEx.cs:139
An immutable set.
Definition: Set.cs:29
static string ParseIdentifier(ref UString source, Action< int, string > onError, out bool checkForNamedLiteral)
Parses an LES-style identifier such as foo, @foo, <tt>foo or –punctuation–.
Definition: Les2Lexer.cs:454
bool IsProperSupersetOf(IEnumerable< T > other, IEqualityComparer< T > comparer, int myExactCount)
Returns true if all items in the other set are present in this set, and this set has at least one ite...
Definition: InternalSet.cs:1590
bool GetAndRemove(ref KeyValuePair< K, V > pair)
Gets the pair associated with pair.Key, then removes the pair with that key from the dictionary.
Definition: MMap.cs:236
BaseParserForList(List list, Token getEofToken, ISourceFile file, int startIndex=0)
Definition: BaseParserForList.cs:83
int MaxIntPowerOf2
Returns the maximum power-of-two-minus-one that can be represented by this type, e....
Definition: Interfaces.cs:139
void AfterNewline(int index)
Allows a lexer to record the index of the character after each line break, in the order they exist in...
Definition: LexerSource.cs:212
static string FormatMessage(Severity type, object context, string format, params object[] args)
Converts a quadruplet (type, context, format, args) to a single string containing all that informatio...
Definition: MessageSink.out.cs:297
bool IsMutable
Returns true if part or all of the block is mutable.
Definition: VListBlock.cs:262
virtual LNode GetListType(LNode type)
Gets the list type for elements of the specified type (e.g. List<type>)
Definition: CodeGenHelperBase.cs:501
A variant of Les3Printer that adds syntax highlighting in one of three ways: as console output,...
Definition: Les3PrettyPrinter.cs:21
A decorator that uses a delegate to accept or ignore messages.
Definition: WrapperSinks.cs:81
bool ContainsKey(byte[] key)
Searches for the specified key, returning true if it is present in the trie.
Definition: CPByteTrie.cs:82
int FindLowerBound(K key, out bool found)
Definition: BMultiMap.cs:353
bool CanAppearIn(Precedence context)
For use in printers. Returns true if an infix operator with this precedence can appear in the specifi...
Definition: Precedence.cs:273
static int UnescapeChar(ref UString s, ref EscapeC encountered)
Unescapes a single character of a string. Returns the first character if it is not a backslash,...
Definition: ParseHelpers.cs:147
static int BinarySearch< T, K >(T[] _array, int _count, K k, Func< T, K, int > compare, bool lowerBound)
Performs a binary search with a custom comparison function.
Definition: InternalList.cs:546
static new void Equals(object a, object b)
Equals() is inherited from object; you probably want to call AreEqual instead.
Definition: MiniTest.cs:470
static readonly Symbol Finally
"#finally" finally clause of #try statement: #finally({...})
Definition: CodeSymbols.cs:159
virtual LNode MakeTriviaAttribute(Token t)
Called to transform a trivia token into a trivia attribute.
Definition: StandardTriviaInjector.cs:157
Either< L, R > IfRight(Action< R > actionR)
Runs actionR if Right.HasValue. Equivalent to Right.Then(actionL), but also returns this.
Definition: Either.cs:85
LesColorCode
These codes are produced as control characters (i.e. cast to char) in the output of Les3PrettyPrinter...
Definition: Les3PrettyPrinter.cs:304
void VerifyCorrectness()
Scans the index to verify that it matches the tree that is being indexed. The scan takes O(N log N + ...
Definition: AListIndexer.cs:255
A standard interface for lexers.
Definition: ILexer.cs:13
Helper methods for IAListTreeObserver<K,T>.
Definition: IAListTreeObserver.cs:118
Helper class. An enumerator that helps enumerate tree data structures. It maintains a virtual call st...
Definition: NestedEnumerator.cs:100
This interface is intended to be implemented by all Loyc collections that implement IList<T>....
Definition: Disambiguation interfaces.cs:88
void ICollection< T >. Add(T item)
Inserts an item at the back (index Count) of the VList.
Definition: VList.cs:373
A mutable bidirectional enumerator interface. Please note that the "Remove" method always moves to th...
Definition: New enumerators.cs:64
static new readonly Symbol DictionaryInitAssign
‘’[]=‘(0, 1, x) <=> [0,1]=x (only supported in 'new’ initializer blocks)
Definition: EcsCodeSymbols.cs:22
Extension methods for exceptions.
Definition: Extensions.cs:47
bool OmitSpaceTrivia
When this flag is set, space trivia attributes are ignored (e.g. CodeSymbols.TriviaNewline).
Definition: Les3PrinterOptions.cs:70
int ErrorCount
Number of errors sent to this object so far, not including detail messages.
Definition: BasicSinks.cs:110
abstract Maybe< Token > MakeEndOfLineToken(Token tokenBeforeNewline, ref Maybe< Token > tokenAfterNewline, int? deltaIndent)
Returns a token to represent the end of a line, or null to avoid generating such a token.
An exception thrown when an attempt is made to modify a read-only object.
Definition: Exceptions.cs:42
static readonly Symbol Default
"'default" for the default(T) pseudofunction in C#
Definition: CodeSymbols.cs:116
A mutable forward range.
Definition: IRanges.cs:228
System.Threading.ThreadState ThreadState
Gets a value containing the states of the current thread.
Definition: ThreadEx.cs:238
Token? EolToken
Gets or sets the prototype token for end-statement (a.k.a. end-of-line) markers, cast to an integer a...
Definition: IndentTokenGenerator.cs:549
static readonly Symbol GT
">" Greater-than operator
Definition: CodeSymbols.cs:49
override bool CallsMin(string name, int argCount)
Returns true if this is a call with the specified name and the specified minimum number of arguments.
Definition: AbstractNodes.cs:143
static object Cache(int num)
If the specified number is in the range -3 to 9 inclusive, an equivalent preallocated boxed integer i...
Definition: CG.cs:40
override string ToString()
Returns ToString() of the wrapped object.
Definition: ReversedList.cs:36
int LeafCount
Number of nodes that don't have a child array.
Definition: InternalSet.cs:1692
Extension/helper methods for ranges.
Definition: Range.cs:11
static T[] Randomized< T >(this IList< T > list)
Quickly makes a copy of a list, as an array, in random order.
Definition: ListExt.cs:742
override T GetLastItem()
Gets the last item in the last leaf node (needed by B+ trees, but is also called by AListBase<K,...
Definition: AListInnerBase.cs:283
static void RemoveRange< T >(this IList< T > list, int index, int count)
Removes count items from list starting at the specified index.
Definition: ListExt.cs:118
static IEnumerable< Pair< A, B > > Zip< A, B >(this IEnumerable< A > a, IEnumerable< B > b)
Returns a sequence of length Min(a.Count(), b.Count()) of items from a and b paired together....
Definition: ListExt.cs:186
static readonly Symbol SwitchExpr
e.g. @'switch(x, { ... }); <=> x switch { ... }
Definition: CodeSymbols.cs:156
long CountMemory(int sizeOfT)
Measures the total size of all objects allocated to this collection, in bytes, including the size of ...
Definition: MSet.cs:444
A read-only wrapper that implements ICollection(T) and ISource(T), returned from LCExt....
Definition: SourceAsCollection.cs:35
Options to control the way Loyc trees are printed by Les2Printer.
Definition: Les2Printer.cs:662
This interface exists to work around a limitation of C#; use IPoint<T> instead.
Definition: IPoint3.cs:25
Maybe< V > GetAndRemove(K key)
Gets the value associated with the specified key, then removes the pair with that key from the dictio...
Definition: MMap.cs:220
override void Reset()
Called when a new, separate printing operation begins.
Definition: Les2PrinterWriter.cs:113
int FindLowerBound(K key)
Definition: BMultiMap.cs:346
LNode GenerateAndPredCheck(AndPred andPred, LNode code, int lookaheadAmt)
Generate code to check an and-predicate during or after prediction, e.g. &!{foo} becomes !...
static readonly Symbol ForwardAssign
Assignment operator with reversed argument order (designed to resemble the pipe operator |>)
Definition: CodeSymbols.cs:59
int FindUpperBound(T item)
Finds the index of the first item in the list that is greater than the specified item.
Definition: BList.cs:385
virtual MMap< K, V > Clone()
Creates a copy of this map in O(1) time, by marking the current root node as frozen.
Definition: MMap.cs:132
virtual void Get(UString name, int id, out Symbol sym)
Workaround for lack of covariant return types in C#
Definition: Symbol.cs:286
bool TryGetValue(int key, out TValue value)
Finds the specified key and gets its associated value, returning true if the key was found.
Definition: CPIntTrie.cs:499
ISourceFile SourceFile
The file being lexed.
Definition: ILexer.cs:17
static void InsertRangeHelper< T >(IList< T > list, int index, int spaceNeeded)
Increases the list size by spaceNeeded and copies elements starting at list[index] "rightward" to mak...
Definition: ListExt.cs:631
long MinInt
Returns the minimum integer that this type can represent.
Definition: Interfaces.cs:147
int SymmetricExceptWith(IEnumerable< T > other, bool xorDuplicates)
Definition: MSet.cs:243
LNode Trivia(string suffix, object value)
Creates a trivia node named "%" + suffix with the specified Value attached.
Definition: LNodeFactory.cs:204
static string NameWithGenericParams(this Type t)
Extension method on Type that is an alias for the Get method.
Definition: MemoizedTypeName.cs:61
void CheckPoint()
Called when a tree modification operation is completed.
Definition: AListNodeObserver.cs:131
Contains information about how a collection is about to change.
Definition: ListChangeInfo.cs:20
A lightweight class to help you compute the minimum, maximum, average and standard deviation of a set...
Definition: Statistic.cs:15
bool IsEnabled(Severity level)
Returns true if Filter(type, null) and target.IsEnabled(type) are both true.
Definition: WrapperSinks.cs:118
bool IsNaN(T value)
Returns true if the given value is not a number (can only be true for floats).
int RevokeOrCommitNewlines(Checkpoint cp, int maxLineWidth)
Revokes or commits newlines added since the specified checkpoint. Recent newlines are revoked if the ...
Definition: PrinterState.cs:147
bool IsNull
Returns true if the internal string is a null reference. Caution: an "empty" UString is "equal" to a ...
Definition: UString.cs:130
T TryPop(out bool isEmpty)
Removes the largest item from the heap (or smallest item, if this is a MinHeap).
Definition: Heap.cs:161
int? FirstIndexOf(T item, int startIndex, EqualityComparer< T > comparer=null)
Scans the list starting at startIndex and going upward, and returns the index of an item that matches...
Definition: AListBase.cs:620
void BeginRule(Rule rule)
Notifies the snippet generator that code generation is starting for a new rule.
Holds a reference to a source file (ISourceFile<char>) and the beginning and end indices of a range i...
Definition: SourceRange.cs:15
A bloom filter for very small sets.
Definition: BloomFilterM64K2.cs:33
abstract bool RemoveAt(uint index, uint count, IAListTreeObserver< K, T > tob)
Removes an item at the specified index.
A set of extended options supported when printing in LES3.
Definition: Les3PrinterOptions.cs:8
virtual LNode CallTryRecognizer(RuleRef rref, int lookahead)
Generates a call to the Try_Scan_*() function that wraps around a Scan_*() recognizer....
Definition: CodeGenHelperBase.cs:454
static Either< L, R > NewRight(R value)
Simply calls the constructor. This method exists to make it possible to construct an Either when both...
static bool MatchesPattern(this LNode candidate, LNode pattern, ref MMap< Symbol, LNode > captures, out LNodeList unmatchedAttrs)
Determines whether one Loyc tree "matches" another. This is different from a simple equality test in ...
Definition: LNodeExt.cs:391
@ UseLogicalNameInErrorMessages
Tells LeMP not to mention the physical method that implements the macro. This improves error message ...
int NewStartingIndex
Returns Index. Exists for compatibility with NotifyCollectionChangedEventArgs.
Definition: ListChangeInfo.cs:60
int BinarySearchI(uint index)
Performs a binary search for an index.
Definition: AListInnerBase.cs:190
@ DropRemainingListItems
If this macro succeeds, all nodes after this one in the current attribute or statement/argument list ...
@ VerbatimId
Indicates that an identifier was marked in the standard way used to indicate that it contained specia...
new void PrintChar(int c, StringBuilder sb)
Definition: LexerSource.cs:159
Definition: CharCategory.out.cs:18
virtual void Reset(List list, Token eofToken, ISourceFile file, int startIndex=0)
Reinitializes the object. This method is called by the constructor.
static bool EndsWith(this StringBuilder sb, UString what, bool ignoreCase=false)
Finds out whether the StringBuilder ends with the specified substring.
Definition: StringBuilderExt.cs:127
Contains macros for using LLLPG in LeMP.
Definition: Macros.cs:18
Symbol Get(UString name, int id)
Creates a Symbol in this pool with a specific ID, or verifies that the requested Name-Id pair is pres...
Definition: Symbol.cs:250
NewlineOpt NewlineOptions
Controls the locations where newlines should be emitted.
Definition: EcsNodePrinter.cs:1370
UString GetTextValue(SourceRange range)
LNode.TextValue returns whatever this returns.
static bool IsPropertyDefinition(LNode n, out LNode retType, out LNode name, out LNode args, out LNode body, out LNode initialValue, Pedantics p=Pedantics.Lax)
Returns true iff the given node has a valid syntax tree for a property definition,...
Definition: EcsValidators.cs:267
UString SourceText(ICharSource chars)
Gets the original source text for a token if available, under the assumption that the specified sourc...
Definition: Token.cs:390
@ SkipSpacesInFront
Skip spaces before the number. Without this flag, initial spaces make parsing fail.
int EndIndex
Returns StartIndex + Length.
Definition: Token.cs:356
List TokenList
The IList{Token} that was provided to the constructor, if any.
Definition: BaseParserForList.cs:120
static Slice_< T > Take< T >(this IListSource< T > list, int count)
Returns a slice of the specified number of elements from the beginning of the list,...
Definition: LinqToLists.out.cs:93
Pred Predictor
Left-hand side of the gate, which is used for prediction decisions.
Definition: Predicates.cs:765
Adapter: a read-only wrapper that implements IList(T) and IListSource(T), returned from LCExt....
Definition: ListSourceAsList.cs:36
Bijection()
Constructs a bijection out of two Dictionary<TKey,TValue> objects.
Definition: Bijection.cs:42
Standard code generator for character/integer input streams and is the default code generator for LLP...
Definition: IntStreamCodeGenHelper.cs:17
LogMessage Msg
Contains additional information about the error that occurred.
Definition: LogException.cs:30
static LNode ParseSingle(this IParsingService parser, UString expr, IMessageSink msgs=null, ParsingMode inputType=null, bool preserveComments=true)
Definition: IParsingService.cs:252
ILineColumnFile IndexToLine(int index)
Returns the position in a source file of the specified index.
Definition: LineRemapper.cs:55
static IEnumerable< Pair< A, B > > ZipLeft< A, B >(this IEnumerable< A > a, IEnumerable< B > b, B defaultB)
Returns a sequence that has the same length as the first sequence, with items from the first and seco...
Definition: ListExt.cs:199
Enhanced C# parser
Definition: EcsLexer.cs:16
static Maybe< V > SwapIfPresent< K, V >(this IDictionaryEx< K, V > dict, K key, V value)
Replaces an item in the map if the key was already present. If the key was not already present,...
Definition: IDictionaryEx.cs:164
object GetValue(SourceRange range)
LNode.Value returns whatever this returns.
int IntersectWith(IEnumerable< T > other, IEqualityComparer< T > comparer)
Removes all items from this set that are not present in 'other'.
Definition: InternalSet.cs:1374
bool SetEquals(ISet< T > other)
Definition: Set.cs:171
static LNode PlusTrailingTrivia(this LNode node, LNode trivia)
Adds additional trailing trivia to a node.
Definition: LNodeExt.cs:81
static readonly Symbol Assembly
e.g. [assembly: Foo] <=> #assembly(Foo);
Definition: CodeSymbols.cs:186
A random-access range that can perform operations such as intersection and overlap tests on pairs of ...
Definition: IRanges.cs:331
A base class for classes that wish to implement IListEx<T>. Provides default implementations for most...
Definition: ListExBase.cs:12
This class enhances LINQ-to-Objects with extension methods that preserve the interface (e....
Definition: LinqToLists.out.cs:26
static readonly Symbol Out
"#out": out x <=> [#out] x
Definition: CodeSymbols.cs:103
AListInnerBase< K, T > HandleChildSplit(int i, AListNode< K, T > splitLeft, ref AListNode< K, T > splitRight, IAListTreeObserver< K, T > tob)
Inserts a slot after _children[i], increasing _childCount and replacing [i] and [i+1] with splitLeft ...
Definition: AListInnerBase.cs:251
virtual bool ShouldGenerateSwitch(IPGTerminalSet[] sets, MSet< int > casesToInclude, bool hasErrorBranch)
Decides whether to use a switch() and for which cases, using BaseCostForSwitch and GetRelativeCostFor...
Definition: CodeGenHelperBase.cs:314
virtual new void Error(int lookaheadIndex, string format, params object[] args)
This method is called to format and handle errors that occur during lexing. The default implementatio...
Definition: LexerSource.cs:153
static readonly ParsingMode Types
Tells IParsingService.Parse to treat the input as a list of types (or a single type,...
Definition: ParsingMode.cs:32
static readonly object BoxedFalse
Singleton false cast to object.
Definition: G.cs:143
Contains helper methods for creating LNodes. An LNodeFactory holds a reference to the current source ...
Definition: LNodeFactory.cs:18
int? BlockChainLength
Gets the number of blocks used by this list.
Definition: WListBase.cs:315
bool SpacesBetweenAppendedStatements
Whether to add a space between multiple statements printed on one line (initial value: true).
Definition: Les2Printer.cs:720
int ItemCount
Number of items in the set.
Definition: InternalSet.cs:1696
object Value
The parsed value of the token, if this structure was initialized with one of the constructors that ac...
Definition: Token.cs:326
int Millisec
Gets or sets the current time on the clock.
Definition: EzStopwatch.cs:71
static readonly Symbol Catch
"#catch" catch clause of #try statement: #catch(#var(Exception,e), whenExpr, {...})
Definition: CodeSymbols.cs:158
override string ToString()
Returns ToString() of the wrapped list.
Definition: NegListSource.cs:119
Internal implementation class. Base class for tree nodes in a list class derived from AListBase<T>....
Definition: AListNode.cs:55
For reference purposes, this interface is a list of the non-static methods that LLLPG expects to be a...
Definition: ILllpgApi.cs:31
override string ToString()
Returns ToString() of the wrapped object.
Definition: WrapperBase.cs:31
static void Success(string format, params object[] args)
Stops a test via StopTestHandler, which, by default, throws a SuccessException.
Definition: MiniTest.cs:308
Exposes a stream as an ICharSource, as though it were an array of characters. The stream must support...
Definition: StreamCharSource.cs:47
Helper class: provides a modified view of an IList by transforming each element on-demand....
Definition: SelectListSource.out.cs:25
Bijection(IDictionary< K1, K2 > cur, IDictionary< K2, K1 > inv)
Constructs a bijection out of two existing dictionaries.
Definition: Bijection.cs:74
bool Calls(Symbol name, int argCount)
Returns true if Name == name and Max + 1 == argCount (which implies Kind == LNodeKind....
UString Replace(UString what, UString replacement, bool ignoreCase=false, int maxReplacements=int.MaxValue)
Returns a new string in which all occurrences (or a specified number of occurrences) of a specified s...
Definition: UString.cs:543
ROLSlice(TList list, int start, int count=int.MaxValue)
Initializes a slice.
Definition: ROLSlice.cs:38
IRange< T > Slice(int start, int count=int.MaxValue)
Returns a sub-range of this list.
static readonly Symbol AndBitsAssign
"'&=" bitwise-and-with operator
Definition: CodeSymbols.cs:131
virtual bool CallsMin(Symbol name, int minArgCount)
Returns true if this is a call with the specified name and the specified minimum number of arguments.
Definition: LNode.cs:730
Definition: LesPrecedenceMap.cs:302
static readonly IdNode Missing
The empty identifier, used to represent missing information.
Definition: LNode.cs:75
int AddRange(IEnumerable< KeyValuePair< K, V >> data, DictEditMode mode)
Merges the contents of the specified sequence into this map.
Definition: MMap.cs:167
This attribute is applied to a method of an interface to specify alternate names that a method can ha...
Definition: GoInterface.cs:2010
Map< K, V > Union(MapOrMMap< K, V > other)
Returns a copy of the current map with the specified items added; each item is added only if the key ...
Definition: Map.cs:310
abstract override LNode Clone()
Creates a copy of the node. Since nodes are immutable, there is little reason for an end-user to call...
NegListSlice(INegListSource< T > list, int start, int count=int.MaxValue)
Initializes a slice.
Definition: NegListSlice.cs:45
Definition: TestMatchCodeMacro.cs:10
override LNode GenerateMatchExpr(IPGTerminalSet set_, bool savingResult, bool recognizerMode)
Generate code to match a set, e.g. MatchRange('a', 'z'); or MatchExcept(' ', '\r'); }....
Definition: IntStreamCodeGenHelper.cs:165
static ThreadDestructor PropagateVariables(int parentThreadId)
Manually initializes ThreadLocalVariable<T> objects in a thread that may not have been started via Th...
Definition: ThreadEx.cs:209
Contains classes related to lexical analysis, such as the universal token type (Loyc....
Definition: NamespaceDocs.cs:111
static StringBuilder TrimStart(this StringBuilder sb, params char[] trimChars)
Removes all leading occurrences of the specified set of characters from the StringBuilder object.
Definition: StringBuilderExt.cs:40
bool IsSupersetOf(InvertibleSet< T > other)
TODO NOT IMPLEMENTED Returns true if all items in the other set are present in this set.
Definition: InvertibleSet.cs:132
FWList< T > SmartSelect(Func< T, T > map)
Maps a list to another list of the same length.
Definition: FWList.cs:191
A class that helps you invoke MacroProcessor on on a set of source files, given a set of command-line...
Definition: Compiler.cs:32
bool IsProperSupersetOf(ISet< T > other)
Definition: MSet.cs:283
virtual LNode CallRule(RuleRef rref, bool recognizerMode)
Generates code to call a rule based on rref.Rule.Name and rref.Params.
Definition: CodeGenHelperBase.cs:433
static readonly Symbol LE
"<=" Less-than-or-equal-to operator
Definition: CodeSymbols.cs:52
Definition: TestStaticMatchCodeMacro.cs:10
abstract uint TotalCount
Gets the total number of (T) items in this node and all children
Definition: AListNode.cs:158
LNode CreateRuleMethod(Rule rule, LNodeList methodBody)
Generates the method for a rule, given the method's contents.
new T Z
Z coordinate of a point or vector.
Definition: IPoint3.cs:32
void NodeRemoved(AListNode< K, T > child, AListInnerBase< K, T > parent)
Called when a child node is removed from an inner node.
Definition: AListNodeObserver.cs:100
static R Do< T, R >(this T obj, Func< T, R > action)
Returns action(obj). This method lets you embed statements in any expression.
Definition: G.cs:129
static string[] GetDefaultCssClassTable()
The lookup table of strings for control codes (LesColorCode values) to HTML classes.
Definition: Les3PrettyPrinter.cs:160
FVList< T > SmartSelectMany(Func< T, IReadOnlyList< T >> map)
Maps a list to another list by concatenating the outputs of a mapping function.
Definition: FVList.cs:607
override bool Calls(Symbol name, int argCount)
Returns true if Name == name and Max + 1 == argCount (which implies Kind == LNodeKind....
Definition: AbstractNodes.cs:138
Provides comparison function for type T along with absolute value (Abs), and the minimum or maximum o...
Definition: Interfaces.cs:44
string CheckErrorMessage
Error string passed to Check() in the generated code if the predicate is not matched....
Definition: Predicates.cs:901
abstract string ToString(MatchType tokenType)
Returns a string representation of the specified token type. These strings are used in error messages...
Options to control the way EcsNodePrinter's output is formatted.
Definition: EcsNodePrinter.cs:1249
AListBase(AListBase< K, T > original, AListNode< K, T > section)
This is the constructor that CopySection(), which can be defined by derived classes,...
Definition: AListBase.cs:259
Implements Enum.TryParse in .NET 3.5
Definition: Enum.cs:9
static void Swap< T >(this IList< T > list, int i, int j)
Swaps list[i] with list[j].
Definition: ListExt.cs:503
Lexer for EC# source code (see ILexer<Token>).
Definition: EcsLexer.cs:22
IMessageSink< LNode >?? ErrorSink
Where errors should be sent if there is an error parsing a literal.
Definition: LNodeFactory.cs:32
static IEnumerable< KeyValuePair< int, T > > Items< T >(this ISparseListSource< T > list)
Returns the non-cleared items in the sparse list, along with their indexes, sorted by index.
Definition: ISparseList.cs:110
static UString SkipSpaces(UString s)
Returns a string with any spaces and tabs removed from the beginning.
Definition: ParseHelpers.cs:599
abstract string Example(IPGTerminalSet set)
Returns an example of an item in the set. If the example is a character, it should be surrounded by s...
WList implementation in which the WList operations are only accessible to a derived class.
Definition: WListBase.cs:30
Adapter: this is a read-only collection of Keys read from a generic IDictionary. It is a modified ver...
Definition: KeyCollection.cs:50
This interface exists to work around a limitation of C#; use IPoint<T> instead.
Definition: IPoint.cs:27
An immutable dictionary.
Definition: Map.cs:201
static bool TryGetValueSafe< K, V >(this IDictionary< K, V > dict, K key, out V value)
Same as IDictionary.TryGetValue() except that this method does not throw an exception when key==null ...
Definition: DictionaryExt.cs:126
virtual void IllegalException(Exception e)
Called when an observer throws something and the exception is being swallowed (because IAListTreeObse...
Definition: AListNodeObserver.cs:127
@ PriorityMask
For internal use to isolate the priority of a macro.
virtual MSet< T > Clone()
Fast-clones the set in O(1) time.
Definition: MSet.cs:131
static bool HasIndex< T >(this IListSource< T > list, int index)
Uses list.TryGet(index) to find out if the specified index is valid.
Definition: IListSource.cs:104
Definition: NumRange.cs:124
LNode InputClass
Specifies a class or namespace to use when calling static functions. There is only one currently: New...
Definition: CodeGenHelperBase.cs:58
int ReconstructIndex(T item, AListLeafBase< K, T > leaf)
Given an item and a leaf that is known to contain a copy of the item, this method returns the index o...
Definition: AListIndexer.cs:213
BaseParser(ISourceFile file=null, int startIndex=0)
Initializes the base class.
Definition: BaseParser.cs:32
Func< T, T, int > _compareItems
Compares two items. See Comparison<T>.
Definition: BList.cs:114
bool IsProperSupersetOf(IEnumerable< T > other)
Definition: Set.cs:164
IEnumerator< T > GetEnumerator()
Enumerates the underlying sequence.
Definition: Co.cs:85
virtual void Prepend(AList< T > other, bool move)
Prepends an AList to this list in sublinear time.
Definition: AList.cs:347
override CallNode WithArgs(LNodeList args)
Creates a Node with a new argument list. If this node is not a call, a new node is created using this...
Definition: AbstractNodes.cs:28
virtual LNode GenerateAndPredCheck(AndPred andPred, LNode code, int li)
Generate code to check an and-predicate during or after prediction, e.g. &!{foo} becomes !...
Definition: CodeGenHelperBase.cs:222
ISourceFile Source
Returns the source file (shortcut for Range.Source).
Definition: LNode.cs:212
LNode Trivia(Symbol name, object value, int startIndex=-1, int endIndex=-1)
Creates a trivia node with the specified Value attached.
Definition: LNodeFactory.cs:211
VListBlockOfTwo(T firstItem, T secondItem, bool mutable)
Initializes a block with two items.
Definition: VListBlockOfTwo.cs:33
Represents a symbol, which is a singleton string that supports fast comparisons and extensible enums.
Definition: Symbol.cs:64
static bool IsPrintableTypeParam(LNode n, Pedantics p=Pedantics.Lax)
Checks if 'n' is a legal type parameter definition.
Definition: EcsValidators.cs:502
Provides the Type() extension method required by Token and the ToString(Token) method to express an L...
Definition: TokenType.cs:52
static VList< T > AddRange(VListBlock< T > self, int localCount, IEnumerator< T > items)
Adds a list of items to an immutable VList (not a FVList).
Definition: VListBlock.cs:505
T TryGet(int index, out bool fail)
Definition: NegList.cs:88
int FindLowerBoundExact(ref K key, out V value, out bool found)
Does the same thing as IndexOfExact, but with the same set of arguments as FindLowerBound including t...
Definition: BMultiMap.cs:405
string Formatted
Formatted string (with substitution and localization applied)
Definition: ILogMessage.cs:22
Standard extension methods for ILNodePrinter.
Definition: ILNodePrinter.cs:41
Helper class: an empty enumerator.
Definition: EmptyEnumerator.cs:10
static double PutInRange(this double n, double min, double max)
Returns num clamped to the range min and max.
Definition: GRange.out.cs:116
@ Default
No style category is specified; the printer should choose a style automatically.
T MaxValue
Maximum value of this type below infinity.
Definition: Interfaces.cs:98
bool Down(List children)
Switches to parsing the specified token list at position zero (typically the value of Loyc....
Definition: BaseParserForList.cs:173
Tests for known slugs (slowness bugs) and fixed bugs (regressions)
Definition: LlpgBugsAndSlugs.cs:10
override bool PrintTriviaExplicitly
Causes comments and spaces to be printed as attributes in order to ensure faithful round-trip parsing...
Definition: Les2Printer.cs:683
static object Cache(short o)
Special overload to avoid treating argument as int32 in C#.
Definition: CG.cs:54
static SavedThreadLocal< LocalizerDelegate > SetLocalizer(LocalizerDelegate newValue)
Sets the localizer method.
Definition: Localize.cs:230
static readonly Symbol Trait
e.g. #trait(Foo, #(IFoo), { }); <=> trait Foo : IFoo { }
Definition: CodeSymbols.cs:164
static readonly Symbol OrBitsAssign
"'|=" set-bits operator
Definition: CodeSymbols.cs:132
static readonly object BoxedVoid
Singleton void cast to object.
Definition: G.cs:145
MacroProcessor(IMessageSink sink)
Initializes MacroProcessor with default prelude.
Definition: MacroProcessor.cs:92
void Print(IEnumerable< LNode > nodes, StringBuilder target, IMessageSink sink=null, ParsingMode mode=null, ILNodePrinterOptions options=null)
Serializes a list of syntax trees to a StringBuilder in the syntax supported by this object.
Definition: EcsLanguageService.cs:54
void Sort(int start, int subcount, Comparison< T > comp)
Definition: AList.cs:375
void Join()
Blocks the calling thread until a thread terminates, while continuing to perform standard COM and Sen...
Definition: ThreadEx.cs:261
virtual bool Equals(ILNode other, CompareMode mode)
Compares two nodes for structural equality. Two nodes are considered equal if they have the same kind...
Definition: LNode.cs:688
Definition: AListLeaf.cs:9
IListSource< LNode > Parse(ILexer< Token > input, IMessageSink msgs, IParsingOptions options)
If HasTokenizer is true, this method accepts a lexer returned by Tokenize() and begins parsing.
Definition: Les3LanguageService.cs:66
static string Localized(this Symbol resourceId, [Localizable] string message, params object[] args)
This is the heart of the Localize class, which localizes and formats a string.
Definition: Localize.cs:314
override LNode DoneAttaching(LNode node, LNode parent, int indexInParent)
This method is called after a node has been processed and any applicable trivia was attached.
Definition: EcsTriviaInjector.cs:77
static string FormatCore(this string format, params object[] args)
This formatter works like string.Format, except that named placeholders accepted as well as numeric p...
Definition: StringExt.cs:191
Helper class for treating a collection of a derived type as a collection of a base type or interface.
Definition: LCExtensions.cs:94
Definition: PrinterState.cs:9
static void Inconclusive(string format, params object[] args)
Stops a test via StopTestHandler, which, by default, throws an InconclusiveException....
Definition: MiniTest.cs:301
void CheckPoint()
Called when a tree modification operation is completed.
Definition: AListIndexer.cs:153
bool Remove(ref KeyWalker key, ref T value)
Removes the specified key and associated value.
Definition: CPTrie.cs:204
This interface provides information about a numeric type T.
Definition: Interfaces.cs:93
Definition: CPIntTrie.cs:883
override LNode GenerateSetDecl(IPGTerminalSet set_, Symbol setName)
Generates a declaration for a variable that holds the set.
Definition: GeneralCodeGenHelper.cs:173
Definition: TestSetOrCreateMemberMacro.cs:11
static Symbol SpaceDefinitionKind(LNode n, out LNode name, out LNode bases, out LNode body, Pedantics p=Pedantics.Lax)
Returns the space kind, which is one of the names #struct, #class, #enum, #interface,...
Definition: EcsValidators.cs:143
T First
Returns the front item of the list (at index 0).
Definition: FWList.cs:227
bool IsProperSupersetOf(ISet< T > other, IEqualityComparer< T > thisComparer, int myExactCount)
Returns true if all items in the other set are present in this set, and this set has at least one ite...
Definition: InternalSet.cs:1581
A dictionary with weak keys.
Definition: WeakKeyDictionary.cs:13
override T FGet(int index, int localCount)
Gets an item at distance 'index' from the front (beginning of an FVList)
Definition: VListBlockArray.cs:99
T Pop()
Removes the front item (at index 0) from the list and returns it.
Definition: FWList.cs:239
static T[] ToArray< T >(this IReadOnlyList< T > c)
Copies the contents of a list to an array.
Definition: LinqToLists.out.cs:190
static Exception InnermostException(this Exception ex)
Gets the innermost InnerException, or ex itself if there are no inner exceptions.
Definition: Extensions.cs:55
virtual void Append(SparseAList< T > other)
Definition: SparseAList.cs:191
long CountMemory(int sizeOfElement)
Counts memory used by the index itself (not including the AList nodes)
int Restart()
Restarts the timer from zero (unpausing it if it is paused), and returns the number of elapsed millis...
Definition: SimpleTimer.cs:46
Token(int type, int startIndex, UString sourceText, NodeStyle style, object valueOrTypeMarker, UString textValue)
Initializes a kind of token designed to store two parts of a literal (see the Remarks for details).
Definition: Token.cs:249
T NextLowerItem(ref int? index)
Decreases index by at least one to reach the next index that is not classified as empty space,...
Definition: ListSourceAsSparse.cs:71
Designed to be used in a "using" statement to temporarily alter a ThreadLocal<T>.
Definition: SavedThreadLocal.cs:10
static NegListSource< T > AsNegList< T >(this IListSource< T > list, int zeroOffset)
Definition: NegListSource.cs:17
new void Skip()
Definition: ParserSource.cs:80
static readonly Symbol _AddressOf
Alias for AndBits.
Definition: CodeSymbols.cs:63
static readonly Symbol OrBits
"|" Bitwise or operator
Definition: CodeSymbols.cs:61
Represents a position in a grammar (GrammarPos) plus the set of characters that leads to that positio...
Definition: KthSet.cs:116
int SpacesPerTab
If tabs are significant, this option controls the number of spaces a single tab should be equated wit...
Definition: IParsingOptions.cs:28
MessageSinkFromDelegate(WriteMessageFn writer, Func< Severity, bool > isEnabled=null)
Initializes this object.
Definition: BasicSinks.cs:172
bool GetAndEdit(ref K key, ref V value, DictEditMode mode)
Combines a get and change operation into a single method call. You rarely need to call this method di...
Definition: BDictionary.cs:450
static readonly Symbol ForwardNullCoalesceAssign
Null-coalescing assignment with reversed argument order.
Definition: CodeSymbols.cs:60
bool ContainsKey(int key)
Searches for the specified key, returning true if it is present in the trie.
Definition: CPIntTrie.cs:397
int Verbosity
Gets or sets the verbosity level. Verbose output can help you debug grammars that don't produce the e...
Definition: LLParserGenerator.cs:113
T Height
Gets the height of a rectangle (the difference between Y coordinates).
Definition: IRectangle.cs:16
void Spaces()
Skips past any spaces at the current position. Equivalent to rule Spaces @[ (' '|'\t')* ] in LLLPG.
Definition: BaseLexer.cs:278
static string Print(this ILNodePrinter printer, LNode node, IMessageSink sink=null, ParsingMode mode=null, ILNodePrinterOptions options=null)
Serializes the specified syntax tree to a string in the syntax supported by the specified ILNodePrint...
Definition: ILNodePrinter.cs:45
static int NextTempCounter
Gets the next number to use as a suffix for temporary variables (without incrementing).
Definition: MacroProcessor.cs:264
new T Last
Gets or sets the value of the last item in the range.
Definition: IRanges.cs:271
override bool Equals(object rhs_)
Returns whether the two list references are the same. Does not compare the contents of the lists.
Definition: VList.cs:138
Definition: TestCompileTimeMacros.cs:15
@ ABFV
Use \f and \v (rather than \xNN or \xNN)
static int NextLargerSize(int than)
As an alternative to the typical enlarging pattern of doubling the array size when it overflows,...
Definition: InternalList.cs:633
Helper class used to enumerate LNode.Descendants().
Definition: DescendantsFrame.cs:46
A dictionary wrapper that provides ListChanging and ListChanged events. Shorthand for Loyc....
Definition: DictionaryWithChangeEvents.cs:13
Extension methods for Loyc Collection interfaces (such as IListSource<T>).
Definition: ListAsListSource.cs:14
virtual void Append(AList< T > other)
Definition: AList.cs:310
int?? Millisec
The getter returns the number of milliseconds since the timer was started; the resolution of this pro...
Definition: SimpleTimer.cs:35
Definition: PreludeMacroTests_Les2.cs:12
NegListSource(IListSource< T > list, int zeroOffset)
Initializes a NegListSource wrapper.
Definition: NegListSource.cs:63
Definition: MacroProcessorTests.cs:18
A list of common symbols that, by convention, have special meaning: operators, built-in data types,...
Definition: CodeSymbols.cs:26
Func< LNode, LNode > ResultSaver
A function that saves the result produced by the matching code of this predicate (null if the result ...
Definition: Predicates.cs:58
static int IndexOf(this StringBuilder sb, char value, int startIndex=0)
Gets the index of a character in a StringBuilder
IMessageSink?? ErrorSink
Gets or sets the object to which error messages are sent. The default object is LogExceptionErrorSink...
Definition: BaseParser.cs:64
override Maybe< Token > NextToken()
Returns the next (postprocessed) token. This method should set the _current field to the returned val...
Definition: TokensToTree.cs:47
Discards all messages. However, there is a Count property that increases by one with each message rec...
Definition: BasicSinks.cs:102
LNode Parent
Gets the logical parent of the current node, which is Ancestors[Ancestors.Count - 2],...
Definition: IMacroContext.cs:48
A compact auto-enlarging list that efficiently supports supports insertions at the beginning or end o...
Definition: DList.cs:23
This just helps end-users to discover the name change SourcePos.PosInLine => ILineAndColumn....
Definition: SourcePos.cs:13
static readonly Symbol NotBits
Unary bitwise inversion operator.
Definition: CodeSymbols.cs:64
This interface allows an object to declare its "location".
Definition: IHasLocation.cs:23
Mainly for internal use by the other GoInterface classes.
Definition: GoInterface.cs:49
int LineNumber
Current line number. Starts at 1 for the first line, unless derived class changes it.
Definition: BaseLexer.cs:229
Definition: TestCodeContractMacros.cs:10
override bool SupportDotIndents()
The LES and EC# languages support "dot indents", which are lines that start with a dot (....
Definition: Les2Lexer.cs:68
A list of Token structures along with the ISourceFile object that represents the source file that the...
Definition: TokenTree.cs:26
abstract object Value
Returns the value of a literal node, or NoValue.Value if this node is not a literal (IsLiteral is fal...
Definition: LNode.cs:338
bool AddComments
Whether to insert Specifies the default maximum lookahead for rules that do not specify a lookahead v...
Definition: LLParserGenerator.cs:117
readonly sbyte Left
Left and Right denote the precedence level on the left and right sides of an operator; see the remark...
Definition: Precedence.cs:248
void Reset(CharSource source, string fileName)
Reinitializes the object (as though the constructor were called again).
Definition: IndexPositionMapper.cs:63
FVList< T > ReplaceAt(int localCount, T item, int distanceFromFront)
Replaces an item in a FVList with another, where localCount is the number of items in the FVList's fi...
Definition: VListBlock.cs:457
static ListSlice< T > SkipNowWhile< T >(this IList< T > list, Func< T, bool > predicate)
Returns a slice without the initial elements of the list that meet the specified criteria....
Definition: LinqToLists.out.cs:342
A list wrapper that provides ListChanging and ListChanged events. Shorthand for Loyc....
Definition: ListWithChangeEvents.cs:12
int SpaceAroundInfixStopPrecedence
The printer avoids printing spaces around infix (binary) operators that have the specified precedence...
Definition: Les3PrinterOptions.cs:102
An exception thrown when a method of Assert fails.
Definition: MiniTest.cs:184
static readonly Symbol Module
e.g. [module: Foo] <=> [Foo] #module;
Definition: CodeSymbols.cs:187
Represents part of a grammar for the LLParserGenerator.
Definition: Predicates.cs:37
static string SanitizeIdentifier(string id)
Eliminates punctuation and special characters from a string so that the string can be used as a plain...
Definition: EcsValidators.cs:818
BMultiMap(Func< K, K, int > compareKeys, Func< V, V, int > compareValues)
Initializes the map with the specified key and value comparers.
Definition: BMultiMap.cs:75
static readonly Symbol IndexBracks
Definition: CodeSymbols.cs:70
This helper class lets you implement IMessageSink with one or two delegates (a writer method,...
Definition: BasicSinks.cs:161
This interface combines the original IList(T) interface with others - IListSource(T),...
Definition: Extended interfaces.cs:67
BMultiMap< string, string > ProcessArguments(IList< string > args, bool warnAboutUnknownOptions, bool autoOpenInputFiles, IList< string > inputFiles=null)
Processes command-line arguments to build a BMultiMap and sends those options to the other overload o...
Definition: Compiler.cs:203
bool StartsWith(UString what, bool ignoreCase=false)
Determines whether this string starts with the specified other string.
Definition: UString.cs:504
Symbol GetIfExists(UString name)
Gets a symbol from this pool, if the name exists already.
Definition: Symbol.cs:321
bool ObeyRawText
Causes raw text to be printed verbatim, as the EC# printer does. When this option is false,...
Definition: Les2Printer.cs:716
@ ProcessChildrenAfter
The macro's result is not reprocessed, but the result's children are processed. This flag only takes ...
static int PutInRange(this int n, int min, int max)
Returns num clamped to the range min and max.
Definition: GRange.out.cs:31
static T[] Randomized< T >(this IReadOnlyList< T > list)
Quickly makes a copy of a list, as an array, in random order.
Definition: ListExt.cs:529
static void Fail(string format, params object[] args)
Fails a test by invoking StopTestHandler.Value(), which, by default, throws an AssertionException.
Definition: MiniTest.cs:286
static bool TryParseInt(string s, ref int index, out int result, int radix=10, bool skipSpaces=true)
Tries to parse a string to an integer. Unlike Int32.TryParse(string, out int), this method allows par...
Definition: ParseHelpers.cs:256
Definition: CollectionDebugView.cs:6
@ CloserFlag
Closers all have this bit set.
static int LastIndexWhere< T >(this IList< T > list, Func< T, bool > pred)
Gets the highest index at which a condition is true, or -1 if nowhere.
virtual AListNode< K, T > Insert(uint index, T item, out AListNode< K, T > splitRight, IAListTreeObserver< K, T > tob)
Inserts an item at the specified index. This method can only be called for ALists,...
Definition: AListNode.cs:67
@ NoUnwrap
If the object to be wrapped is already wrapped, GoInterface<Interface> will normally unwrap it before...
bool IsEnabled(Severity level)
Returns true if messages of the specified type will actually be printed, or false if Write(type,...
Definition: WrapperSinks.cs:219
static readonly Symbol NullIndexBracks
<tt>?[](foo, #(1, A)) <=> foo?[1, A] (TENTATIVE, may be changed later)
Definition: CodeSymbols.cs:82
bool Remove(int key, ref TValue oldValue)
Removes the specified key and associated value, returning true if the entry was found and removed.
Definition: CPIntTrie.cs:466
This interface models the capabilities of an array: getting and setting elements by index,...
Definition: INegListSource.cs:71
Classes related to Enhanced C# (mostly found in Loyc.Ecs.dll).
Definition: EcsCodeSymbols.cs:7
ArraySlice(T[] list, int start, int count)
Initializes an array slice.
Definition: ArraySlice.cs:40
static int NumberOfAmbiguousMethods
The number of methods in the interface for which a matching method in T could not be found because T ...
Definition: GoInterface.cs:498
ParserSource(IEnumerator< Token > list, Token eofToken, ISourceFile file, int startIndex=0)
<inheridoc>
Definition: ParserSource.cs:139
BaseParserForList(IEnumerable< Token > list, Token getEofToken, ISourceFile file, int startIndex=0)
<inheridoc>
Definition: BaseParserForList.cs:231
override bool RemoveAt(uint index, uint count, IAListTreeObserver< K, T > tob)
Removes an item at the specified index.
Definition: AListInnerBase.cs:364
@ InternalFlag
Reserved for use by specific compilers/languages.
bool Remove(T item)
Finds a specific item and removes it. If duplicates of the item exist, only the first occurrence is r...
Definition: AList.cs:783
int _eofIndex
_eofIndex is the character index of EOF if it has been reached or, if not, the index of the first uns...
Definition: StreamCharSource.cs:66
StringBuilder PrintToHtml(IEnumerable< ILNode > nodes, StringBuilder output=null, bool addPreCode=true)
Definition: Les3PrettyPrinter.cs:198
Extension methods for strings, such as SplitAt, Left, Right, FormatCore and Slice.
Definition: StringExt.cs:12
void DetectSizeOverflow(int insertSize)
Throws OverflowException if inserting the specified number of items would cause Count to overflow.
Definition: AList.cs:677
Statistics returned from InternalSet<T>.CountMemory.
Definition: InternalSet.cs:1687
abstract void MuClear(int localCountWithMutables)
Clears all mutable items in this chain, and clears the mutable flag. If this block owns mutable items...
IListSource< LNode > Parse(ICharSource text, string fileName, IMessageSink msgs, IParsingOptions options)
Parses a source file into one or more Loyc trees.
Contains general-purpose classes that are not considered important enough to go directly into the Loy...
Definition: NamespaceDocs.cs:117
int IntersectWith(MSet< T > other)
Removes all items from this set that are not present in 'other'.
Definition: MSet.cs:234
static string GetLocationString(object context)
Gets the location information from the specified object, or converts the object to a string....
Definition: MessageSink.out.cs:96
static IEnumerable< Out > SelectFilter< T, Out >(this IEnumerable< T > list, Func< T, Maybe< Out >> filter)
Combines 'Select' and 'Where' in a single operation.
Definition: EnumerableExt.cs:278
Provides increment, decrement, and next/previous-representable- value operations.
Definition: Interfaces.cs:154
int Offset
Returns the offset added to indexes in the original list, which equals -Min.
Definition: NegListSource.cs:54
int FindUpperBound(K key)
Finds the index of the first item in the list whose key is greater than the specified key.
Definition: BMultiMap.cs:391
Base class that helps efficiently keep track of statistics about the contents of one or more AListBas...
Definition: AListStatisticTracker.cs:27
Represents the text form of a literal value, without its parsed value.
Definition: ILiteralValue.cs:10
IListSource< LNode > Parse(IListSource< Token > input, ISourceFile file, IMessageSink msgs, IParsingOptions options)
Parses a token tree, such as one that came from a token literal.
Definition: EcsLanguageService.cs:93
OperatorShape
An enum of common operator formats.
Definition: OperatorShape.cs:8
A collection of Symbols.
Definition: Symbol.cs:180
static bool TryGet< T >(this IListSource< T > list, int index, ref T value)
Tries to get a value from the list at the specified index.
Definition: IListSource.cs:84
object[] Args
Values to be substituted into the format string.
Definition: ILogMessage.cs:20
static string WithoutPrefix(this string s, string prefix, StringComparison mode=StringComparison.Ordinal)
Returns a version of the string without the specified prefix. If the string does not have the specifi...
override void MuClear(int localCountWithMutables)
Clears all mutable items in this chain, and clears the mutable flag. If this block owns mutable items...
Definition: VListBlockOfTwo.cs:128
MMap< K, V > Intersect(MapOrMMap< K, V > other)
Definition: MMap.cs:288
static bool TryParseHex(UString s, out int value)
A simple method to parse a sequence of hex digits, without overflow checks or other features supporte...
Definition: ParseHelpers.cs:19
T NextHigherItem(ref int? index)
Increases index by at least one to reach the next index that is not classified as empty space,...
Definition: SparseAList.cs:285
static Interface ForceFrom(T obj)
Creates a wrapper regardless of whether or not T could be wrapped completely.
Definition: GoInterface.cs:434
GrammarPos Do(GrammarPos input)
Computes the "canonical" interpretation of a position.
Definition: LLParserGenerator.cs:932
Please use the new name of this class: LineColumnFile. Holds a filename (FileName),...
Definition: SourcePos.cs:72
override string Example(IPGTerminalSet set_)
Returns an example of an item in the set. If the example is a character, it should be surrounded by s...
Definition: IntStreamCodeGenHelper.cs:118
static readonly LNode InParensTrivia
Used by the quote {...} macro.
Definition: LNode.cs:132
Symbol TypeMarker
A prefix or suffix on the literal that represents some additional meaning.
Definition: CustomLiteral.cs:26
static V AddOrUpdate< K, V >(this IDictionary< K, V > dict, K key, Func< K, V > addValueFactory, Func< K, V, V > updateValueFactory)
Uses the specified functions either to add a key/value pair to the dictionary if the key does not alr...
Definition: DictionaryExt.cs:41
Macros for using LLLPG in LeMP.
Definition: Macros.cs:57
static LNode PlusTrailingTrivia(this LNode node, LNodeList trivia)
Adds additional trailing trivia to a node.
Definition: LNodeExt.cs:76
void Push(T item)
Synonym for Add(); adds an item to the front of the list.
Definition: WListBase.cs:406
Severity PrintSeverityAt
Minimum severity level at which the severity level is printed. For example, if set to Severity....
Definition: BasicSinks.cs:31
override LNode GenerateTest(IPGTerminalSet set_, LNode subject, Symbol setName)
Generates code to test whether a terminal is in the set.
Definition: GeneralCodeGenHelper.cs:131
static readonly Symbol Matches
"=~" Pattern match test operator
Definition: CodeSymbols.cs:53
static LNodeList IncludingAttributes(this LNodeList list, LNodeList attributes)
Prepends attributes to the first item in a list, except for trailing trivia (trailing(....
Definition: LNodeExt.cs:157
Definition: LinqToLists.out.cs:279
int AddRange(IEnumerable< KeyValuePair< K, V >> data, DictEditMode mode)
Merges the contents of the specified sequence into this map.
@ PriorityFallbackMin
Lowest priority. If this macro is ambiguous with another macro that doesn't have this flag,...
virtual IEnumerable< LNode > GetCases(IPGTerminalSet set)
Gets the literals or symbols to use for switch cases of a set (just the values, not including the cas...
Definition: CodeGenHelperBase.cs:310
int IntersectWith(IEnumerable< T > other)
Definition: MSet.cs:223
@ AddOrReplace
Insert a key-value pair, replacing an existing one if the key already exists.
static readonly Symbol Struct
e.g. #struct(Foo, #(IFoo), { }); <=> struct Foo : IFoo { }
Definition: CodeSymbols.cs:163
static readonly ParsingMode Declarations
Tells IParsingService.Parse to treat the input as a list of statements. If the language makes a disti...
Definition: ParsingMode.cs:29
ILineColumnFile IndexToLine(int index)
Returns the position in a source file of the specified index.
Definition: ILexer.cs:78
static bool IsInRangeExcludeHi(this long num, long lo, long hi)
Returns true if num is between lo and hi, excluding hi but not lo.
Definition: GRange.out.cs:57
static int Base36DigitValue(char c)
Gets the integer value for the specified digit, where 'A' maps to 10 and 'Z' maps to 35,...
Definition: ParseHelpers.cs:58
void Add(T item)
An alias for PushLast().
Definition: DList.cs:214
An abstract representation of a prediction tree, which will be transformed into prediction code....
Definition: PredictionTree.cs:68
Enumerates through a VList from index 0 up to index Count-1.
Definition: VList.cs:437
Filters out tokens whose Value is WhitespaceTag.Value.
Definition: WhitespaceFilter.cs:9
bool CanPrint(Symbol typeMarker)
Returns true if there is a printer function for the given type marker. Never throws.
Definition: LiteralHandlerTable.cs:90
Token(int type, int startIndex, int length, NodeStyle style=0, object value=null)
Initializes the Token structure.
Definition: Token.cs:86
Represents an LLLPG rule, which is a Predicate plus a Name and optional attributes (e....
Definition: Rule.cs:16
virtual void Prepend(SparseAList< T > other, bool move)
Prepends an AList to this list in sublinear time.
Definition: SparseAList.cs:204
TokenKind
A list of token categories that most programming languages have.
Definition: TokenKind.cs:47
The new WeakReference<T> type in .NET 4.5 removes the Target and IsAlive properties....
Definition: WeakReference.cs:13
Definition: CPByteTrie.cs:299
IBinumerator< T > Begin()
Returns a binumerator that points before the beginning of the current collection.
@ MatchEveryIdentifier
The macro will be called for every identifier node (if its namespace is imported).
static bool ResemblesSuffixOperator(Symbol name, out Symbol bareName)
Decides whether the name resembles a suffix operator.
Definition: LesPrecedenceMap.cs:290
bool IsIndexed
Indicates whether the AList is indexed.
Definition: IndexedAList.cs:100
LiteralNode UninterpretedLiteral(Token t)
This method produces a literal by assuming that the provided token is an uninterpreted literal (see N...
Definition: LNodeFactory.cs:193
static readonly Symbol Return
e.g. #return(x); <=> return x; [#yield] #return(x) <=> yield return x;
Definition: CodeSymbols.cs:143
Task< LNodeList >[] ProcessAsync(IReadOnlyList< InputOutput > sourceFiles, Action< InputOutput > onProcessed=null)
Processes source files in parallel using .NET Tasks. The method returns immediately.
Definition: MacroProcessor.cs:243
int FindUpperBound(K key)
Finds the index of the first item in the list that is greater than the specified item.
Definition: BDictionary.cs:257
static readonly Symbol As
"'as": @'as(x,string) <=> x as string <=> x(as string)
Definition: CodeSymbols.cs:108
Definition: Extended interfaces.cs:72
static Comparison< T > ToComparison< T >()
Gets a Comparison<T> for the specified type.
Definition: G.cs:164
@ SingleQuotes
Escape single quotes as \'
override void Error(int lookaheadIndex, string message)
This method is called to handle errors that occur during lexing.
Definition: EcsLexer.cs:74
bool Find(ref T item)
Definition: Set.cs:84
IReadOnlyList< LNode > Ancestors
Returns a list of ancestors of the current node being processed. Normally Ancestors[0] is a #splice n...
Definition: IMacroContext.cs:39
virtual Symbol NewSymbol(int id, string name)
Factory method to create a new Symbol.
Definition: Symbol.cs:312
static LNode WithoutOuterParens(this LNode self)
Removes a single pair of parentheses, if the node has a inParens attribute. Returns the same node whe...
Definition: LNodeExt.cs:331
Either< Symbol, ILogMessage > TryPrint(ILNode literal, StringBuilder sb)
Attempts to convert the specified literal to a string.
static bool operator==(LNodeList lhs, LNodeList rhs)
Returns whether the two list references are the same. Does not compare the contents of the lists.
int SpaceAroundInfixStopPrecedence
The printer avoids printing spaces around infix (binary) operators that have the specified precedence...
Definition: EcsNodePrinter.cs:1375
bool IsProperSupersetOf(Set< T > other)
Definition: MSet.cs:279
static ListSlice< T > Take< T >(this IList< T > list, int count)
Returns a slice of the specified number of elements from the beginning of the list,...
Definition: LinqToLists.out.cs:317
abstract AListNode< K, T > CopySection(uint index, uint count, AListBase< K, T > list)
Extracts and returns, as fast as possible, a subrange of the list that this node represents.
static LocalizerDelegate Localizer
Localizer method, which is a do-nothing pass-through by default
Definition: Localize.cs:217
static Exception Catch(Action code)
Verifies that a delegate throws an exception when called and returns it.
Definition: MiniTest.cs:592
static int RemoveAll< T >(this IList< T > list, Predicate< T > match)
Removes the all the elements that match the conditions defined by the specified predicate.
Definition: ListExt.cs:567
bool Overlaps(IEnumerable< T > other)
Returns true if this set contains at least one item from 'other'.
Definition: MSet.cs:265
Entry point of LLLPG.exe, with QuickRun() method to help invoke LLLPG programmatically.
Definition: Program.cs:18
virtual LNode WithName(Symbol name)
Creates a node with a new value for Name.
Definition: LNode.cs:320
bool CallsMin(Symbol name, int argCount)
Returns true if Kind == LNodeKind.Call, Name == name, and Max + 1 >= argCount.
bool Overlaps(InvertibleSet< T > other)
TODO NOT IMPLEMENTED Returns true if this set contains at least one item from 'other'.
Definition: InvertibleSet.cs:137
bool IsSet(int index)
Determines whether a value exists at the specified index.
static MessageSinkWithContext WithContext(object context, string messagePrefix=null)
Creates a message sink that writes to MessageSink.Default with a default context to be used when Writ...
Definition: MessageSink.out.cs:327
CastOptions
Options you can pass to GoInterface.From()
Definition: GoInterface.cs:366
bool OmitSpaceTrivia
When this flag is set, space trivia attributes are ignored (e.g. CodeSymbols.TriviaNewline).
Definition: Les2Printer.cs:691
For reference purposes, this interface contains the non-static methods that LLLPG expects lexers to i...
Definition: ILllpgApi.cs:89
BDictionary(int maxNodeSize)
Definition: BDictionary.cs:58
A mutable set.
Definition: MSet.cs:47
A mutable random-access range.
Definition: IRanges.cs:348
Action< T, int > OnItemMoved
This optional callback is called whenever an item is placed into the heap, removed from the heap,...
Definition: Heap.cs:56
A four-byte tuple that represents the precedence and miscibility of an operator.
Definition: Precedence.cs:219
static string WithSymbol(string resourceId, [Localizable] string message, params object[] args)
Definition: Localize.cs:324
BaseParserForList(IList< Token > list, Token getEofToken, ISourceFile file, int startIndex=0)
<inheridoc>
Definition: BaseParserForList.cs:221
Definition: AListBase.cs:672
virtual void Error(int lookaheadIndex, string format, params object[] args)
This method is called to format and handle errors that occur during lexing. The default implementatio...
Definition: BaseLexer.cs:604
static SavedValue< Func< object, string > > SetContextToString(Func< object, string > contextToString)
Sets the strategy that message sinks should use to convert a context object to a string.
Definition: MessageSink.out.cs:143
A compact auto-enlarging array structure that is intended to be used within other data structures....
Definition: InternalList.cs:47
virtual bool SupportDotIndents()
The LES and EC# languages support "dot indents", which are lines that start with a dot (....
Definition: BaseILexer.cs:116
void AddAll(AListNode< K, T > node)
Called when all children are being added to a node (leaf or inner). Notifications are not sent for in...
Definition: AListNodeObserver.cs:116
Definition: KeyCollection.cs:134
static LocalizerDelegate?? GlobalDefaultLocalizer
Gets or sets the localizer used when one has not been assigned to the current thread with SetLocalize...
Definition: Localize.cs:204
@ MatchIdentifierOnly
If this flag is present, the macro can match a plain identifier but cannot match calls.
void ProcessParallel(IReadOnlyList< InputOutput > sourceFiles, Action< InputOutput > onProcessed=null)
Processes source files in parallel. All files are fully processed before the method returns.
Definition: MacroProcessor.cs:235
bool Find(ref T item)
Searches for an item. If the item is found, the copy in the set is returned in the 'item' parameter....
Definition: MSet.cs:87
Represents a FIFO (first-in-first-out) queue (or a priority queue if IPriorityQueue<ThisAssembly> is ...
Definition: Queue interfaces.cs:44
static T[] ToArray< T >(this ICollectionSource< T > list)
Converts the collection to an array.
Definition: ICollectionSource.cs:53
static AppDomain GetDomain()
Returns the current domain in which the current thread is running.
Definition: ThreadEx.cs:252
static readonly Symbol Import
#import is used instead of #using because the using(...) {...} statement already uses #using
Definition: CodeSymbols.cs:188
int ImmCount
Gets the number of immutable elements in-use in our local array.
Definition: VListBlock.cs:304
T AddOne(T a)
Returns a + 1.
LNodeList PreProcess(LNodeList input, bool asRoot=false, bool resetOpenNamespaces=false, bool resetProperties=false, bool areAttributes=false)
Runs the macro processor on the specified node(s).
T Pop()
Removes the largest item from the heap (or smallest item, if this is a MinHeap).
Definition: Heap.cs:175
override int IndexOf(T item)
Finds an index of an item in the list.
Definition: IndexedAList.cs:65
Combines IDictionary, IReadOnlyDictionary, and IDictonarySink with a few additional methods.
Definition: IDictionaryEx.cs:33
static readonly Symbol NullForwardPipeArrow
ԉ۪?|>`(a, b) <=> a ?|> b
Definition: EcsCodeSymbols.cs:26
bool WarnAboutUnprintableLiterals
Whether to print a warning when an "unprintable" literal is encountered. In any case the literal is c...
Definition: Les3PrinterOptions.cs:76
static bool IsInRangeExcludeHi(this double num, double lo, double hi)
Returns true if num is between lo and hi, excluding hi but not lo.
Definition: GRange.out.cs:108
Token(int type, int startIndex, int length, NodeStyle style, Symbol typeMarker, UString textValue)
Initializes an "uninterpreted literal" token (see the Remarks).
Definition: Token.cs:202
virtual void AfterNewline()
The lexer must call this method exactly once after it advances past each newline, even inside comment...
Definition: BaseLexer.cs:238
int Min
Returns the minimum valid index in the collection.
Definition: INegListSource.cs:19
static ILexer< Token > Tokenize(this IParsingService parser, UString input, IMessageSink msgs=null)
Parses a string by invoking IParsingService.Tokenize(ICharSource, string, IMessageSink,...
Definition: IParsingService.cs:218
T TryPeek(out bool isEmpty)
Gets the largest item from the heap if it is not empty (or the smallest item, if this is a MinHeap).
Definition: Heap.cs:191
V TryGet(K key, out bool fail)
Gets the item for the specified key or index, and does not throw an exception on failure.
@ Space
Represents a space character. Spaces are special because they do not consume physical space at the en...
static readonly Symbol AltList
# is used for lists of things in definition constructs, e.g. #class(Derived, #(Base,...
Definition: CodeSymbols.cs:94
void RootChanged(AListBase< K, T > list, AListNode< K, T > newRoot, bool clear)
Called when the root of the tree changes, or when the list is cleared. Also called after Attach(),...
Definition: AListIndexer.cs:88
Implementation of VListBlock(of T) that contains an array. It is always initialized with at least one...
Definition: VListBlockArray.cs:16
int IndexOf(T item)
Searches for the specified object and returns the zero-based index of the first occurrence (lowest in...
Definition: WListBase.cs:173
bool IsSubsetOf(IEnumerable< T > other)
Returns true if all items in this set are present in the other set.
Definition: MSet.cs:254
static VListBlock< T > Add(VListBlock< T > self, int localCount, T item)
Adds an item to the "front" of an immutable FVList.
Definition: VListBlock.cs:355
Definition: PreludeMacroTests_Les3.cs:12
static bool TryParseInt(ref UString input, out long result, int radix=10, ParseNumberFlag flags=0)
Definition: ParseHelpers.cs:274
IListSource< LNode > Parse(ICharSource text, string fileName, IMessageSink msgs, IParsingOptions options)
Parses a source file into one or more Loyc trees.
Definition: EcsLanguageService.cs:71
V TryGetValue(K key, V defaultValue)
Synonym for this[key, defaultValue].
Definition: Map.cs:155
string NewlineString
Specifies the string to use for line breaks (typically "\n").
Definition: ILNodePrinterOptions.cs:73
static readonly Symbol If
e.g. #if(c,x,y) and #if(c,x); I wanted it to be the conditional operator too, but the semantics are a...
Definition: CodeSymbols.cs:135
Map()
Creates an empty map. Consider using Empty instead.
Definition: Map.cs:210
Definition: ILineColumnFile.cs:16
bool ContainsKey(byte[] key, int offset, int length)
Searches for the specified key, returning true if it is present in the trie.
Definition: CPByteTrie.cs:92
LNode GenerateMatch(IPGTerminalSet set_, bool savingResult, bool recognizerMode)
Generate code to match a set, e.g. MatchRange('a', 'z'); or MatchExcept(' ', '\r'); }....
bool CanParse(Symbol typeMarker)
Returns true if this object has a parser for the specified type marker.
bool SpaceInsideListBrackets
Whether to print a space inside square brackets for lists [ ... ].
Definition: Les3PrinterOptions.cs:43
Holds an argument list compatible with IMessageSink<TContext>.Write(Severity,TContext,...
Definition: LogMessage.cs:13
The batch-operation methods of IListEx<T>, mainly for collection types that can add or remove multipl...
Definition: Extended interfaces.cs:45
Designed to be used in a "using" statement to temporarily alter a ThreadLocalVariable<T> or Holder<T>...
Definition: SavedValue.cs:12
static LNodeList WithoutTrailingTrivia(this LNodeList attrs, out LNodeList trailingTrivia)
Gets a new list with any trailing attributes removed. Trailing trivia inside those attributes are ret...
Definition: LNodeExt.cs:64
Either< L2, R2 > R2(selectL(_left)) Either< L2, R > MapLeft< L2 >(Func< L, L2 > selectL)
Transforms Left with the given selector, if Left.HasValue. Otherwise, returns Right unchanged.
Assert()
You may find it useful to derive a test fixture from Assert so that you do not need to prefix every t...
Definition: MiniTest.cs:251
Represents a LIFO (last-in-first-out) stack.
Definition: Queue interfaces.cs:50
T[] ToArray()
Returns the VList converted to an array.
Definition: VList.cs:284
abstract TokenCategory GetTokenCategory(Token token)
Gets the category of a token for the purposes of indent processing.
Base class of all nodes that represent simple identifiers (including special symbols such as #foo).
Definition: AbstractNodes.cs:15
override string ChooseGotoLabel()
Optional. If this predicate represents the matching code for a branch of an Alts and this code is rea...
Definition: Predicates.cs:227
abstract override LNode Clone()
Creates a copy of the node. Since nodes are immutable, there is little reason for an end-user to call...
static object Cache(sbyte o)
Special overload to avoid treating argument as int32 in C#.
Definition: CG.cs:52
UString Substring(int start, int count)
Synonym for Slice()
Definition: UString.cs:352
void RemoveAll(AListNode< K, T > node)
Called when all children are being removed from a node (leaf or inner) because the node is being spli...
UString Find(UString what, bool ignoreCase=false)
Finds the specified string within this string.
Definition: UString.cs:435
void NodeAdded(AListNode< K, T > child, AListInnerBase< K, T > parent)
Called when a child node is added to an inner node.
Definition: AListNodeObserver.cs:92
static LNode WithTrailingTrivia(this LNode node, LNodeList trivia)
Removes a node's trailing trivia and adds a new list of trailing trivia.
Definition: LNodeExt.cs:42
This interface for parsing text into objects is implemented by LiteralHandlerTable.
Definition: ILiteralParser.cs:10
A simple base class that helps you use the decorator pattern on a set. By default,...
Definition: SetWrapper.cs:14
Interface for types that can duplicate themselves.
Definition: MiscInterfaces.cs:10
LiteralNode LiteralFromValueOf(Token t)
Creates a literal whose LNode.Value is the same as the value of t.
Definition: LNodeFactory.cs:182
static bool IsNaturalOperator(UString name)
Returns true if the given Symbol can be printed as an operator without escaping it in LESv2.
Definition: LesPrecedenceMap.cs:226
static readonly Symbol NullCoalesceAssign
"'??=": a ??= b means a = a ?? b
Definition: CodeSymbols.cs:120
static bool EscapeCStyle(int c, StringBuilder @out, EscapeC flags=EscapeC.Default, char quoteType='\0')
Writes a character c to a StringBuilder, either as a normal character or as a C-style escape sequence...
Definition: PrintHelpers.cs:80
object Target
Gets the object being written to (TextWriter or StringBuilder)
Definition: INodePrinterWriter.cs:20
Definition: PrinterState.cs:227
Bijection(IReadOnlyCollection< KeyValuePair< K1, K2 >> input)
Constructs a bijection out of two Dictionary<TKey,TValue> objects, copying the specified initial cont...
Definition: Bijection.cs:53
static readonly Symbol Property
e.g. #property(#int32, Foo, @``, { get; }) <=> int Foo { get; }
Definition: CodeSymbols.cs:175
Used by the ThreadEx.ThreadStarting and ThreadEx.ThreadStopping events.
Definition: ThreadEx.cs:303
int DefaultK
Specifies the default maximum lookahead for rules that do not specify a lookahead value.
Definition: LLParserGenerator.cs:50
void Swap(SparseAList< T > other)
Swaps the contents of two SparseAList<T>s in O(1) time.
Definition: SparseAList.cs:181
VListBlockOfTwo()
Initializes a mutable block with no items.
Definition: VListBlockOfTwo.cs:21
static readonly Symbol DoWhile
e.g. #doWhile(x++, condition); <=> do x++; while(condition);
Definition: CodeSymbols.cs:136
UString TextValue
Represents the serialized text of the value.
Definition: ILiteralValue.cs:25
static readonly Symbol ColonColon
"'::" Scope resolution operator in many languages
Definition: CodeSymbols.cs:114
BDictionary()
Initializes an empty BList.
Definition: BDictionary.cs:55
static int LastIndexOf(this StringBuilder sb, char searchChar, int startIndex=int.MaxValue)
Gets the index of a character in a StringBuilder
Definition: StringBuilderExt.cs:104
SeverityMessageFilter(IMessageSink< TContext > target, Severity minSeverity, bool includeDetails=true)
Initializes the filter with a minimum severity.
Definition: WrapperSinks.cs:26
override LNode GenerateSetDecl(IPGTerminalSet set, Symbol setName)
Generates a declaration for a variable that holds the set.
Definition: IntStreamCodeGenHelper.cs:137
Static methods that help with common parsing jobs, such as parsing integers, floats,...
Definition: ParseHelpers.cs:13
ListChangeInfo(IListSource< T > collection, NotifyCollectionChangedAction action, int index, int sizeChange, IListSource< T > newItems=null) readonly NotifyCollectionChangedAction Action
This contructor is meant for ListChanging events only (not ListChanged). It computes the OldItems pro...
Definition: ListChangeInfo.cs:46
T FallbackValue
When a thread is not created using ThreadEx, the value of your ThreadLocalVariable fails to propagate...
Definition: ThreadEx.cs:588
string Format
Format string (without substitutions or localization)
Definition: ILogMessage.cs:18
FWList< T > ToFWList()
Returns this list as a FWList, which effectively reverses the order of the elements.
Definition: VList.cs:268
@ PriorityFallback
Low priority. If this macro is ambiguous with another macro that doesn't have this flag nor FallbackM...
Represents a collection that produces a sequence of items, and can return the next item without poppi...
Definition: Queue interfaces.cs:18
static Slice_< T > Skip< T >(this IListSource< T > list, int start)
Skips the specified number of elements immediately and returns a slice of part of the list that remai...
Definition: LinqToLists.out.cs:86
int CountMemory(int sizeOfT, out InternalSetStats stats)
Measures the total size of all objects allocated to this collection, in bytes, and counts the number ...
Definition: InternalSet.cs:1678
static bool IsNormalIdentifier(Symbol name)
Returns true if the given symbol can be printed as a normal identifier, without an "@" prefix....
static bool AutoClone(ref AListNode< K, T > node, AListInnerBase< K, T > parent, IAListTreeObserver< K, T > tob)
Checks whether 'node' is frozen and if so, replaces it with an unfrozen copy.
Definition: AListNode.cs:230
static readonly Symbol PostInc
"suf++" Unary suffix increment
Definition: CodeSymbols.cs:39
static StringBuilder TrimEnd(this StringBuilder sb)
Removes all trailing occurrences of spaces and tabs from the StringBuilder object.
Definition: StringBuilderExt.cs:50
abstract bool IsFullLeaf
Returns true if the node is full and is a leaf node.
Definition: AListNode.cs:164
virtual ? char ExampleChar(IPGTerminalSet set)
Returns an example of a character in the set, or null if this is not a set of characters or if EOF is...
Definition: CodeGenHelperBase.cs:128
SpaceOpt
Controls the locations where spaces appear as EcsNodePrinter is printing.
Definition: EcsNodePrinter.cs:1169
This class produces global symbols.
Definition: Symbol.cs:143
A version of BaseLexer<CharSrc> that implements ILexer<Token>. You should use this base class if you ...
Definition: BaseILexer.cs:44
void ItemRemoved(T item, AListLeafBase< K, T > parent)
Called when an item is removed from a leaf node.
Definition: AListIndexer.cs:104
Represents a terminal (which is a token or a character) or a set of possible terminals (e....
Definition: Predicates.cs:951
override bool HasSimpleHead()
Returns true if this is not a call, or if the call's Target is an Id or a Literal.
Definition: AbstractNodes.cs:144
static readonly Symbol Break
e.g. #break(); <=> break;
Definition: CodeSymbols.cs:145
int IntersectWith(InternalSet< T > other, IEqualityComparer< T > otherComparer)
Removes all items from this set that are not present in 'other'.
Definition: InternalSet.cs:1340
static readonly Symbol Fixed
e.g. #fixed(#var(@'of(ԉ۪*`, #int32), x = &y), stmt); <=> fixed(int* x = &y) stmt;
Definition: CodeSymbols.cs:151
override FVList< T > SubList(int localIndex)
Returns a list in which this[localIndex-1] is the first item. Nonpositive indexes are allowed and ref...
Definition: VListBlockArray.cs:215
int CountMemory(int sizeOfT)
Measures the total size of all objects allocated to this collection, in bytes, including the size of ...
Definition: InternalSet.cs:1670
A message sink wrapper that has a default value for the context parameter, which is used when the con...
Definition: WrapperSinks.cs:175
@ SkipUnderscores
Skip underscores inside number. Without this flag, underscores make parsing stop.
virtual LNode ErrorBranch(IPGTerminalSet covered, int laIndex)
Generates code for the default error branch of prediction (called when there is no explicit error bra...
Definition: CodeGenHelperBase.cs:282
virtual object LaIndexToMsgContext(int lookaheadIndex)
Converts a lookahead token index to a SourceRange (or to a string if SourceFile was initialized to nu...
Definition: BaseParser.cs:139
static LNode InParens(this LNode node)
Returns the same node with a parentheses attribute added.
Definition: LNodeExt.cs:313
@ Control
Escape all characters with codes below 32, including \t
static bool Equals(LNodeList a, LNodeList b, CompareMode mode=CompareMode.Normal)
Compares two lists of nodes for structural equality.
Definition: LNode.cs:600
FVList< T > Push(T item)
Synonym for Add(); adds an item to the front of the list.
Definition: FVList.cs:215
static Maybe< V > TryGet< K, V >(this ITryGet< K, V > self, K key)
Returns the value at the specified key or index, wrapped in Maybe<V>.
Definition: Other interfaces.cs:85
Symbol Get(UString name)
Gets a symbol from this pool, or creates it if it does not exist in this pool already.
Definition: Symbol.cs:231
Trivia injector customized for Enhanced C#.
Definition: EcsTriviaInjector.cs:46
T Last
Returns the value of the last item in the range.
Definition: IRanges.cs:254
static string DescriptionAndStackTrace(this Exception ex)
Definition: Extensions.cs:65
static StringBuilder TrimStart(this StringBuilder sb)
Removes all leading occurrences of spaces and tabs from the StringBuilder object.
Definition: StringBuilderExt.cs:37
@ TQStringLiteral
Used for a triple-quoted string literal like '''foo'''.
LNodeList WhereSelect(Func< LNode, Maybe< LNode >> filter)
Filters and maps a list with a user-defined function.
T First
Returns the front item of the list (at index 0), which is the head of the list.
Definition: FVList.cs:192
int Log2Floor(T a)
Returns the floor of the base-2 logarithm of x. e.g. 1024 -> 10, 1000 -> 9
Marks a method that is to be called prior to each test in a test fixture.
Definition: MiniTest.cs:136
static readonly Symbol LT
"<" Less-than operator
Definition: CodeSymbols.cs:51
Definition: IDictionaryEx.cs:183
T Ceiling(T value)
Gets the closest integer equal to or higher than the specified number.
static IParsingService?? Default
Gets or sets the default language service on this thread. If no service has been assigned on this thr...
Definition: IParsingService.cs:101
void Reset()
Resets the timer to 0 and pauses it there.
Definition: EzStopwatch.cs:95
Marks a benchmark test, which exists to test performance. Benchmark tests are often run multiple time...
Definition: MiniTest.cs:154
void Detach(AListBase< K, T > list, AListNode< K, T > root)
Called when the observer is being detached from an AList. Detach(), unlike Attach(),...
virtual new void AfterNewline()
The lexer must call this method exactly once after it advances past each newline, even inside comment...
Definition: LexerSource.cs:99
All GoInterface wrappers implement this interface.
Definition: GoInterface.cs:120
A custom literal is a normal number or string paired with a (typically unrecognized) type prefix or s...
Definition: CustomLiteral.cs:15
An wrapper around ISourceFile that applies line remapping information (if the source file uses it).
Definition: LineRemapper.cs:29
bool Is(int type, object value)
Returns true if the specified type and value match this token.
bool IsSigned
Returns true if T can represent negative values.
Definition: Interfaces.cs:122
@ OneLiner
Indicates that the there is no comment or newline trivia associated with the children of this node,...
A trivial class that holds a single value of type T in the Value property.
Definition: Holder.cs:18
Traverses a CPTrie<T>. Returned by CPTrie<T>.ValueEnumerator().
Definition: CPTrieMisc.cs:11
virtual new void Reset(List source, Token eofToken, ISourceFile file, int startIndex=0)
Definition: ParserSource.cs:43
static IParsingService GetServiceForFileName(string filename)
Finds the language service associated with the longest matching registered file extension.
Definition: IParsingService.cs:173
Map< K, V > Without(K key)
Returns a copy of the current map without the specified key.
Definition: Map.cs:289
bool ObeyRawText
Causes raw text to be printed verbatim, as the EC# printer does. When this option is false,...
Definition: Les3PrinterOptions.cs:81
static MessageSinkFromDelegate FromDelegate(WriteMessageFn writer, Func< Severity, bool > isEnabled=null)
Sends all messages to a user-defined method.
Definition: MessageSink.out.cs:318
VListBlockArray(FVList< T > prior, int localCapacity, bool mutable)
Inits an empty block.
Definition: VListBlockArray.cs:57
@ Retrieve
Do not change the collection.
char????? DigitSeparator
Gets or sets a character used to separate groups of digits. It must be must be _ or ' or null,...
Definition: StandardLiteralHandlers.cs:183
static StringBuilder AppendCodePoint(this StringBuilder s, int c)
Appends a unicode code point in the range 0 to 0x10FFFF to StringBuilder in UTF-16.
Definition: StringBuilderExt.cs:184
static object LocationOf(object context)
Returns context.Location if context implements IHasLocation; otherwise, returns context itself.
Definition: MessageSink.out.cs:72
Definition: AListExt.cs:10
static readonly Symbol Label
e.g. #label(success) <=> success:
Definition: CodeSymbols.cs:141
Loyc.Syntax.dll: contains Loyc trees (Loyc.Syntax.LNode), lexing stuff, LLLPG base classes (BaseParse...
Definition: EmptySourceFile.cs:6
static string Passthrough(Symbol msgId, string msg)
This is the dummy translator, which is the default value of Localizer. It passes strings through untr...
Definition: Localize.cs:292
TokenTree Children
Returns Value as TokenTree (null if not a TokenTree).
Definition: Token.cs:342
static readonly IEqualityComparer< T > DefaultComparer
This is EqualityComparer<T>.Default, or null if T implements IReferenceEquatable.
Definition: InternalSet.cs:376
void PrintChar(int c, StringBuilder sb)
Prints a character as a string, e.g. 'a' -> "'a'", with the special value -1 representing EOF,...
Definition: BaseLexer.cs:682
bool ReplaceIfPresent(ref K key, ref V value)
Replaces the value associated with a specified key, if it already exists in the dictionary.
Definition: BDictionary.cs:535
Lexer for EC# source code.
Definition: Les2Lexer.cs:23
static readonly Symbol MulAssign
"'*=" multiply-and-set operator
Definition: CodeSymbols.cs:121
T NextLowerItem(ref int? index)
Decreases index by at least one to reach the next index that is not classified as empty space,...
bool IsEquivalency
If true, this is an "<=>" equivalency gate, otherwise it's a "=>" normal gate.
Definition: Predicates.cs:792
override int GetRelativeCostForSwitch(IPGTerminalSet set_)
Used to help decide whether a "switch" or an if statement will be used to handle a prediction tree,...
Definition: GeneralCodeGenHelper.cs:239
@ Change
Include the modified item in the output list
static T MinOrDefault< T >(this IEnumerable< T > list, Func< T, int > selector, T defaultValue=default(T))
Returns the item in the list that has the minimum value for some selector.
Definition: EnumerableExt.cs:224
T Shl(T a, int amount)
Shifts 'a' left by the specified number of bits.
override Maybe< Token > NextToken()
Scans the next token and returns information about it.
Definition: Les2LexerGrammar.out.cs:863
int ClearAfter(int minimumMillisec)
Restarts the timer from zero if the specified number of milliseconds have passed, and returns the for...
Definition: EzStopwatch.cs:121
InternalList< T > CloneAndTrim()
Makes a copy of the list with Capacity = Count
Definition: InternalList.cs:311
DictEditMode
Helper enum for IDictionaryEx<K, V>.GetAndEdit.
Definition: IDictionaryEx.cs:9
static void PrintECSharp(LNode node, StringBuilder target, IMessageSink sink, ParsingMode mode, ILNodePrinterOptions options=null)
Prints a node as EC# code.
Definition: EcsNodePrinter.cs:122
void RemoveAll(AListNode< K, T > node)
Called when all children are being removed from a node (leaf or inner) because the node is being spli...
Definition: AListIndexer.cs:123
int IndentLevel
Gets the number of spaces that were used to indent the current line, where a tab counts as rounding u...
Definition: BaseILexer.cs:68
@ MatchEveryLiteral
The macro will be called whenever any kind of literal is encountered (if its namespace is imported).
@ BreakAfter
Represents a character after which a line break can be added. The most common example of this categor...
Represents a read-only 2D rectangle.
Definition: IRectangle.cs:42
void InsertRange(int index, ISparseListSource< T > list)
Inserts another sparse list into this one.
Definition: SparseAList.cs:132
bool IsEnabled(Severity level)
Returns true if messages of the specified type will actually be printed, or false if Write(type,...
static readonly Symbol Cast
"'cast": @'cast(x,int) <=> (int)x <=> x(-> int)
Definition: CodeSymbols.cs:110
static List< LNode > FlattenBinaryOpSeq(LNode expr, Symbol opName, bool? rightAssociative=null)
Converts a sequence of the same operator (e.g. x+y+z) to a list (e.g. x, y, z).
Definition: LNode.cs:820
virtual new void Error(int lookaheadIndex, string format)
This method is called to handle errors that occur during lexing.
Definition: LexerSource.cs:151
bool IsInfinity(T value)
Returns true if the given value is infinite.
Precedence(int left, int right, int lo, int hi)
Initializes an operator with the given precedence on the left and right sides, and the given immiscib...
Definition: Precedence.cs:233
override int GetHashCode()
Returns the hashcode of the wrapped object.
Definition: WrapperBase.cs:26
Maybe< V > GetAndRemove(K key)
TODO: TEST THIS!!
Definition: BDictionary.cs:438
This interface is intended to be implemented by all Loyc collections that implement IDictionary<K,...
Definition: Disambiguation interfaces.cs:113
T Value
Value of the thread-local variable.
Definition: ThreadEx.cs:549
static LNodeList WithoutTrailingTrivia(this LNodeList attrs)
Gets a new list with any trailing attributes removed.
Definition: LNodeExt.cs:58
bool IsInverted
When Inverted is true, the set behaves as if it contains the opposite set of items....
Definition: IntSet.cs:30
static LNodeList GetTrailingTrivia(this LNode node)
Gets all trailing trivia attached to the specified node.
Definition: LNodeExt.cs:27
MMap< K, V > Union(MapOrMMap< K, V > other)
Definition: MMap.cs:279
static readonly Symbol Compare
"<=>" Three-way comparison a.k.a. shaceship operator
Definition: CodeSymbols.cs:54
static void ProcessCommandLineArguments(IList< string > args, ICollection< KeyValuePair< string, string >> options, string atFolder, IDictionary< char, string > shortOptions=null, InvertibleSet< string > twoArgOptions=null, int argLimit=0xFFFF, bool expandEnvVars=true, bool caseSensitiveLongOpts=false)
Expands environment variables (e.g. TEMP%) and @files in a list of command-line arguments,...
Definition: UG.cs:119
static ? int FirstIndexWhere< T >(this IReadOnlyList< T > source, Func< T, bool > pred)
Gets the lowest index at which a condition is true, or null if nowhere.
Definition: IListSource.cs:143
A read-only list of characters plus a Slice(int,int) method.
Definition: ICharSource.cs:52
T Last
Returns the last item of the list (at index Count-1).
Definition: WList.cs:220
static readonly Symbol Xor
"^^" Logical 'xor' operator (tentative–this operator is redundant, "!=" is equivalent)
Definition: CodeSymbols.cs:44
virtual AListNode< K, T > InsertRange(uint index, IListSource< T > source, ref int sourceIndex, out AListNode< K, T > splitRight, IAListTreeObserver< K, T > tob)
Inserts a list of items at the specified index. This method may not insert all items at once,...
Definition: AListNode.cs:84
int SpaceAfterPrefixStopPrecedence
The printer avoids printing spaces after prefix operators that have the specified precedence or highe...
Definition: Les2Printer.cs:729
static bool IsIsTest(LNode n, out LNode subject, out LNode targetType, out LNode targetVarName, out LNode extraArgs, Pedantics p=Pedantics.Lax)
Checks whether an expression is a valid "is" test (pattern- matching expression) such as "x is Foo",...
Definition: EcsValidators.cs:637
override Maybe< Token > NextToken()
Returns the next (postprocessed) token. This method should set the _current field to the returned val...
Definition: EcsPreprocessor.cs:86
BaseParserForList(IEnumerable< Token > list, Func< Token, Token > getEofToken, MatchType eof, ISourceFile file, int startIndex=0)
<inheridoc>
Definition: BaseParserForList.cs:234
PGIntSet WithEOF(bool wantEOF=true)
Adds or removes EOF from the set. If the set doesn't change, this method may return this.
Definition: PGIntSet.cs:33
WList< T > Where(Func< T, bool > filter)
Applies a filter to a list, to exclude zero or more items.
Definition: WList.cs:142
static readonly Symbol NamedArg
"'::=" Named argument e.g. ‘’::=`(x, 0) <=> x: 0
Definition: CodeSymbols.cs:100
static int CountOnes(uint x)
Definition: G.cs:290
A trie that supports signed and unsigned keys with sizes up to 64 bits. Special encodings are used to...
Definition: CPIntTrie.cs:47
@ Repeat
Include the modified item in the output, and transform it again
AListOperation
Indicates the way an add operation (such as BList<T>.Do should behave when an item being added to a s...
Definition: AListNode.cs:452
Definition: TestUserDefinedMacroMacro.cs:11
abstract override string ToString(MatchType tokenType)
Returns a string representation of the specified token type. These strings are used in error messages...
IList< T > OriginalList
Gets the list that was passed to the constructor of this instance.
Definition: NegList.cs:45
@ __AddThreshold
Lowest-numbered "add" command. For internal use only.
readonly InternalList< IntRange > _ranges
A list of non-overlapping character ranges, sorted by code point. EOF can be included in this list as...
Definition: IntSet.cs:24
bool IsProperSupersetOf(ISet< T > other)
Definition: Set.cs:162
static bool TryParseFloatParts(ref UString source, int radix, out bool negative, out ulong mantissa, out int exponentBase2, out int exponentBase10, out int numDigits, ParseNumberFlag flags=0)
Parses the parts of a floating-point string. See the other overload for details.
Definition: ParseHelpers.cs:527
Definition: ILiteralValue.cs:43
T MinValue
Minimum value of this type above negative infinity.
Definition: Interfaces.cs:96
Precedence LeftContext(Precedence outerContext)
For use in printers. Auto-raises the precedence floor to prepare to print an expression on the left s...
Definition: Precedence.cs:254
This class's main job is to maintain a table of Precedence values for LES operators....
Definition: LesPrecedenceMap.cs:17
Provides access to a thread-local variable through a dictionary that maps thread IDs to values.
Definition: ThreadEx.cs:468
static readonly ConsoleMessageSink Console
Sends all messages to the System.Console.WriteLine(string).
Definition: MessageSink.out.cs:313
static readonly Symbol Sizeof
"'sizeof" sizeof(int) <=> @'sizeof(int)
Definition: CodeSymbols.cs:105
void Write(Severity level, TContext context, string format)
Writes a message to the target that this object represents.
Definition: WrapperSinks.cs:224
Represents a location in a grammar: a predicate and a "return stack" which is a so-called persistent ...
Definition: KthSet.cs:148
Observes changes and builds a table of items in the tree.
Definition: AListIndexer.cs:42
bool CanPreserveComments
Returns true if the parser supports preserving comments.
Definition: IParsingService.cs:36
static bool SubstringEquals(StringBuilder sb, int start, UString what, bool ignoreCase=false)
Checks if the sequences of characters what is equal to sb.Substring(start, what.Length),...
Definition: StringBuilderExt.cs:145
Represents a sequence of predicates (Preds).
Definition: Predicates.cs:234
void Print(LNode node, StringBuilder target, IMessageSink sink=null, ParsingMode mode=null, ILNodePrinterOptions options=null)
Serializes the specified syntax tree to a StringBuilder in the syntax supported by this object.
int FindLowerBound(T item)
Definition: BList.cs:330
BList(int maxLeafSize, int maxInnerSize)
Definition: BList.cs:64
static readonly Symbol ModAssign
"'%=" set-to-remainder operator
Definition: CodeSymbols.cs:123
LNodeList SmartSelectMany(Func< LNode, IReadOnlyList< LNode >> map)
Maps a list to another list by concatenating the outputs of a mapping function.
Abstract base class for INodePrinterWriter. Has an protected _indentLevel field that is increased by ...
Definition: INodePrinterWriter.cs:42
Thrown by Assert.Ignore().
Definition: MiniTest.cs:200
A container for the follow set of a Rule.
Definition: Predicates.cs:979
IEnumerable< LNode > Start(Holder< TokenType > separator)
Top-level rule: expects a sequence of statements followed by EOF
Definition: Les3.cs:202
Either< object, ILogMessage > TryParse(UString textValue, Symbol typeMarker)
Attempts to parse a string with a given type marker.
Definition: LiteralHandlerTable.cs:120
T Last
Returns the last item of the list (at index Count-1), which is the head of the list.
Definition: VList.cs:200
static int IncrementTempCounter()
Gets the next number to use as a suffix for temporary variables, then increments it.
Definition: MacroProcessor.cs:269
@ AllowMissingParams
Allow the cast even if NumberOfMethodsMissingParameters > 0
static float TryParseFloat(ref UString source, int radix, ParseNumberFlag flags=0)
Parses a string to a single-precision float, returning NaN on failure or an infinity value on overflo...
Definition: ParseHelpers.cs:580
BList(BList< T > items, bool keepListChangingHandlers)
Definition: BList.cs:104
ICI
Flags for EcsNodePrinter.IsComplexIdentifier.
Definition: EcsNodePrinter.cs:1144
Shared base class for "full-stack" LLLPG tests that use LeMP, the Ecs parser, and LLLPG macros in add...
Definition: LlpgGeneralTestsBase.cs:19
bool PrefixNotationOnly
Print purely in prefix notation, e.g. ‘’+`(2,3) instead of 2 + 3.
Definition: Les3PrinterOptions.cs:97
Pred ErrorBranch
Specifies the action to take for error input. If an error branch is specified, it serves as the defau...
Definition: Predicates.cs:473
Helper methods for making LLLPG grammar nodes. Used by LlpgCoreTests.
Definition: LlpgCoreTests.cs:15
A simple base class that helps you use the decorator pattern on a collection. By default,...
Definition: CollectionWrapper.cs:18
NodeStyle
Suggests a printing style when serializing a Loyc tree to text.
Definition: NodeStyle.cs:24
A simple version of Compiler that takes a single input and produces a StringBuilder....
Definition: MacroProcessorTests.cs:137
bool IsEnabled(Severity level)
Returns true if s.IsEnabled(type) is true for at least one target message sink 's'.
Definition: WrapperSinks.cs:155
Parses LES (Loyc Expression Syntax) code into a sequence of Loyc trees (LNode), one per top-level sta...
Definition: Les2Parser.cs:26
Holds the IsEmpty property that tells you if a collection is empty.
Definition: ICount.cs:25
Represents a collection that accepts a sequence of items.
Definition: Queue interfaces.cs:8
override LNode LAType()
Returns the data type of LA(k)
Definition: GeneralCodeGenHelper.cs:224
bool AddParser(bool replaceExisting, Symbol typeMarker, Func< UString, Symbol, Either< object, LogMessage >> parser)
Adds a parser to the Parsers collection.
Definition: LiteralHandlerTable.cs:44
static readonly Symbol Await
await(x); <=> await x; (TENTATIVE: should this be changed to #await?)
Definition: CodeSymbols.cs:81
Helper type returned from LCExt.AsListSource<T>(IReadOnlyList<T>).
Definition: ReadOnlyListAsListSource.cs:33
T PopFirst(out bool fail)
Removes the first item from the range and returns it.
bool IsEmptySet
Returns true iff the set is empty. When the set is inverted and contains the set of all integers,...
Definition: IntSet.cs:221
MMap< K, V > Except(MapOrMMap< K, V > other)
Definition: MMap.cs:295
Bundles the optional original text of a value with an optional in-memory form of it; see remarks at I...
Definition: LiteralValue.cs:8
Standard extension methods for ITryGet<K, V>.
Definition: Other interfaces.cs:76
readonly sbyte Lo
Lo and Hi specify the miscibility of an operator; see the remarks of Precedence for details.
Definition: Precedence.cs:244
LNode GenerateSwitch(IPGTerminalSet[] branchSets, LNode[] branchCode, MSet< int > casesToInclude, LNode defaultBranch, LNode laVar)
Generates a switch statement with the specified branches where branchCode[i] is the code to run if th...
static int TryParseHex(ref UString s, out int value)
A simple method to parse a sequence of hex digits, without overflow checks or other features supporte...
Definition: ParseHelpers.cs:28
LNodeKind Kind
Definition: ILNode.cs:47
static uint PutInRange(this uint n, uint min, uint max)
Returns num clamped to the range min and max.
Definition: GRange.out.cs:48
static StringBuilder AppendIntegerTo(StringBuilder target, long value, string prefix="", int @base=10, int separatorInterval=3, char separatorChar='_')
Same as IntegerToString(long, string, int, int, char) except that the target StringBuilder must be pr...
Definition: PrintHelpers.cs:180
A helper class used by LLLPG for backtracking.
Definition: BaseLexer.cs:438
static void Inconclusive()
Short for Inconclusive("").
Definition: MiniTest.cs:324
IListSource< Trivia > SortedTrivia
List of trivia to be injected by Run. Must be sorted.
Definition: AbstractTriviaInjector.cs:93
static bool IsInRangeExcludeHi(this uint num, uint lo, uint hi)
Returns true if num is between lo and hi, excluding hi but not lo.
Definition: GRange.out.cs:40
Directs code generation using the visitor pattern to visit the predicates in a rule....
Definition: GenerateCodeVisitor.cs:26
bool IsProperSupersetOf(Set< T > other)
Definition: Set.cs:158
int TypeInt
Token type.
Definition: Token.cs:284
void SetCurrentValue(T value, ref InternalSet< T > set, IEqualityComparer< T > comparer)
Changes the value associated with the current key.
Definition: InternalSet.cs:1161
T NextLower(T a)
Returns the next representable number lower than a.
@ HasInvalid6DigitEscape
While unescaping, a valid \U escape was encountered with 6 digits, but the number was more than 0x10F...
bool AddIfNotPresent(ref K key, ref V value)
Add a pair if it is not alredy present, or get its value if it is.
Definition: BDictionary.cs:470
MMap(IEnumerable< KeyValuePair< K, V >> copy)
Creates a map with the specified elements.
Definition: MMap.cs:49
bool Remove(KeyValuePair< K, V > item)
Removes a pair from the map.
Definition: MMap.cs:117
@ Remove
Remove the item with the specified key if present.
int NodeCount
Total number of nodes.
Definition: InternalSet.cs:1690
FWList< T > Transform(VListTransformer< T > x)
Transforms a list (combines filtering with selection and more).
Definition: FWList.cs:214
static readonly Symbol _Negate
Alias for Sub. Infix and prefix operators use same symbol.
Definition: CodeSymbols.cs:36
@ Operator
Indicates that a node was parsed as an operator (infix, prefix, suffix, or other operator),...
Definition: TestOnFinallyReturnThrowMacros.cs:13
T Epsilon
Smallest representable positive value of T (1 for integer types).
Definition: Interfaces.cs:100
Severity MinSeverity
Gets or sets the minimum severity that passes the filter. Note: usually this property should be set t...
Definition: WrapperSinks.cs:40
void CopyTo(T[] array, int arrayIndex)
Copies the elements of the collection to an Array, starting at a particular array index.
Definition: DList.cs:229
bool AddOrFind(ref T item, bool replaceIfPresent)
Adds the specified item to the set, and retrieves an existing copy of the item if one existed....
Definition: MSet.cs:105
void Clear()
Clears the list and frees the memory used by the list. Can also be used to initialize a list whose co...
Definition: InternalList.cs:260
int IndexOf(T item)
Searches for the specified object and returns the zero-based index of the first occurrence (lowest in...
Definition: FVList.cs:341
A standard base class for enumerator frames used by NestedEnumerator{EnumeratorFrame{T},...
Definition: NestedEnumerator.cs:193
VList represents a reference to a reverse-order FVList.
Definition: VList.cs:50
Helper class: provides a modified view of an IListSource by transforming each element on-demand....
Definition: SelectListSource.out.cs:101
Definition: TestCodeQuoteMacro.cs:10
static string StripExtraWhitespace(string a, string[] commentPrefixes=null)
Strips whitespace and single-line comments from a string. Helps test whether two blocks of code are "...
Definition: MacroProcessorTests.cs:178
static int RemoveRange< K, V >(this IDictionary< K, V > dict, IEnumerable< K > list)
Tries to remove a set of key-values from a dictionary based on their keys.
Definition: DictionaryExt.cs:155
static void Ignore(string format, params object[] args)
Stops a test via StopTestHandler, which, by default, throws an IgnoreException. This causes the test ...
Definition: MiniTest.cs:293
A variation of IReadOnlyCollection that provides the Contains() and CopyTo() methods from ICollection...
Definition: ICollectionSource.cs:32
A default implementation of ISourceFile based on IndexPositionMapper.
Definition: SourceFile.cs:11
Bijection(IEnumerable< KeyValuePair< K1, K2 >> input, int capacity=0)
Constructs a bijection out of two Dictionary<TKey,TValue> objects, copying the specified initial cont...
Definition: Bijection.cs:58
IReadOnlyDictionary< Symbol, VList< MacroInfo > > AllKnownMacros
Gets information about all macros registered with the macro processor, including macros whose namespa...
Definition: IMacroContext.cs:119
A simple base class that to helps you implement a "smart" collection. By default, all it does is forw...
Definition: ListWrapper.cs:17
ILNode Target
Definition: ILNode.cs:52
int IntersectWith(ISet< T > other)
Removes all items from this set that are not present in 'other'.
Definition: MSet.cs:236
static ArraySlice< byte > Convert(string s)
Decodes a BAIS string back to a byte array.
Definition: ByteArrayInString.cs:130
Contains IndexToLine method.
Definition: IIndexPositionMapper.cs:17
static readonly TraceMessageSink Trace
Sends all messages to System.Diagnostics.Trace.WriteLine(string).
Definition: MessageSink.out.cs:310
static readonly Symbol Shr
">>" Right-shift operator
Definition: CodeSymbols.cs:55
Please use the new name of this class, LineColumnFile. This is a LineColumnFile that also includes th...
Definition: LineRemapper.cs:71
UString Substring(int start)
Returns the sequence of code units from this UString starting at the index start, e....
Definition: UString.cs:368
LNode CreateTryWrapperForRecognizer(Rule rule)
See IPGCodeGenHelper.CreateTryWrapperForRecognizer for more information.
Definition: CodeGenHelperBase.cs:396
static SavedThreadLocal< FormatterDelegate > SetFormatter(FormatterDelegate newValue)
Sets the formatter method.
Definition: Localize.cs:241
Creates and controls a thread, and fills in a gap in the .NET framework by propagating thread-local v...
Definition: ThreadEx.cs:58
A bidirectional range that can perform operations such as intersection and overlap tests on pairs of ...
Definition: IRanges.cs:301
static bool IsInRange(this float num, float lo, float hi)
Returns true if num is between lo and hi.
Definition: GRange.out.cs:95
Adapter: provides a view of an IListSource<T> in which the Count is the same, but the minimum index i...
Definition: NegListSource.cs:38
bool RemoveAny(K key)
Removes one pair from the collection that matches the specified key.
Definition: BMultiMap.cs:163
ILiteralPrinter LiteralPrinter
Requests that a specific printer be used to convert literals into strings.
Definition: ILNodePrinterOptions.cs:80
Definition: ILineColumnFile.cs:5
A simple wrapper around AList that includes an AListIndexer<K,T> that can be used to find items relat...
Definition: IndexedAList.cs:31
Standard cell, used to encode keys in a CPSNode
Definition: CPSNode.cs:12
TokenKind Kind
Token category. This value is only meaningful if the token type integers are based on TokenKinds....
Definition: Token.cs:289
A simple implementation of IParsingOptions.
Definition: IParsingOptions.cs:32
IRange< T > Slice(int start, int count=int.MaxValue)
Returns a sub-range of this list.
AListNode< K, T > CopySectionHelper(int start, int subcount)
Together with the AListBase<K,T>.AListBase(AListBase<K,T>,AListNode<K,T>) constructor,...
Definition: AListBase.cs:1038
WList< T > Transform(VListTransformer< T > x)
Transforms a list (combines filtering with selection and more).
Definition: WList.cs:207
static List< InputOutput > OpenSourceFiles(IMessageSink sink, IEnumerable< string > fileNames)
Opens a set of source files by file name, and creates a text file for each.
Definition: Compiler.cs:522
override void AfterNewline()
The lexer must call this method exactly once after it advances past each newline, even inside comment...
Definition: BaseILexer.cs:123
@ AttrKeyword
e.g. public, private, static, virtual
Maybe< Token > NextToken()
Scans the next token and returns information about it.
Definition: EcsLexer.cs:54
bool IsProperSubsetOf(IEnumerable< T > other)
Definition: Set.cs:155
static char HexDigitChar(int value)
Gets the hex digit character for the specified value, or '?' if the value is not in the range 0....
Definition: PrintHelpers.cs:17
void ItemRemoved(T item, AListLeafBase< K, T > parent)
Called when an item is removed from a leaf node.
Definition: AListNodeObserver.cs:84
Represents a text file with a file name and its textual content, plus the data necessary to convert b...
Definition: ISourceFile.cs:12
LNode LaType
Specifies the data type of LA0 and lookahead variables.
Definition: GeneralCodeGenHelper.cs:37
This interface exists to work around a limitation of C#; see IRectangle3<T>.
Definition: IRectangle3.cs:75
An adapter that converts a collection of keys to an IReadOnlyDictionary. Used by EnumerableExt....
Definition: SelectDictionaryFromKeys.cs:59
Represents a double-ended queue that allows items to be added or removed at the beginning or end.
Definition: Queue interfaces.cs:63
The Value property provides easy access to the lexer, parser and printer for Enhanced C#.
Definition: EcsLanguageService.cs:20
VList< T > SmartWhere(Func< T, bool > keep)
Applies a filter to a list, to exclude zero or more items.
Definition: VList.cs:547
This defines a Group with the operation +, the neutral element Zero, and an operation - that is defin...
Definition: Interfaces.cs:209
void RegisterMacro(MacroInfo macroInfo)
Registers a new macro in the current scope.
static StringBuilder TrimEnd(this StringBuilder sb, params char[] trimChars)
Removes all trailing occurrences of the specified set of characters from the StringBuilder object.
Definition: StringBuilderExt.cs:53
static readonly Symbol _Pointer
Alias for Mul.
Definition: CodeSymbols.cs:34
static object Unwrap(object obj)
Unwraps an object if it was wrapped by GoInterface. Unwrapping is recursive, so that if a wrapper is ...
Definition: GoInterface.cs:97
static IListSource< LNode > Parse(this IParsingService parser, UString input, IMessageSink msgs, IParsingOptions options)
Parses a string by invoking IParsingService.Parse(ICharSource, string, IMessageSink,...
Definition: IParsingService.cs:234
Helps you implement read-only collections by providing default implementations for most methods of IC...
Definition: ReadOnlyCollectionBase.cs:19
UString TextValue(ICharSource source)
Helps get the "text value" from tokens that used one of the constructors designed to support this use...
Definition: Token.cs:404
void CopyTo(T[] array, int arrayIndex)
Copies the elements of the collection to an Array, starting at a particular array index.
Definition: ListSlice.cs:232
virtual void ProcessChildrenOfOneLiner(ref LNode node)
This method is called when a node has no newlines or comments within it (although the node may still ...
Definition: AbstractTriviaInjector.cs:145
A collection wrapper that provides ListChanging and ListChanged events. Shorthand for Loyc....
Definition: CollectionWithChangeEvents.cs:12
This defines a Field with the operations +,-,*,/
Definition: Interfaces.cs:307
@ ReplaceIfPresent
Replace an existing pair if present, or do nothing if no matching key.
bool IsInverted
Returns true if the set is inverted, which means that the enumerator returns all the items that are n...
Definition: ISetImm.cs:51
void ICollection< T >. Add(T item)
Inserts an item at the front (index 0) of the FVList.
Definition: FVList.cs:392
virtual bool TryAdd(T item)
Synonym for Add(). If the collection implements ISet{T}, this method returns false if the item is alr...
Definition: CollectionWithChangeEvents.cs:50
static readonly Symbol Delegate
e.g. #delegate(#int32, Foo, @'tuple()); <=> delegate int Foo();
Definition: CodeSymbols.cs:174
int ForcedLineBreakThreshold
Although the LES3 printer is not designed to insert line breaks mid-expression or to keep lines under...
Definition: Les3PrinterOptions.cs:124
A base class for wrappers that modify lexer behavior. Implements the ILexer interface,...
Definition: ILexer.cs:38
abstract LNodeList Args
Returns the argument list of this node. Always empty when IsCall==false.
Definition: LNode.cs:378
void Add(int key, TValue value)
Adds the specified key-value pair to the trie, throwing an exception if the key is already present.
Definition: CPIntTrie.cs:364
void ClearSpace(int index, int count=1)
Unsets the range of indices index to index+count-1 inclusive. If index + count > Count,...
Definition: SparseAList.cs:237
static Interface From(T obj)
Creates a wrapper if the interface matches T well.
Definition: GoInterface.cs:441
static IEnumerable< MacroInfo > GetMacros(Type type, IMessageSink errorSink=null, Symbol @namespace=null, object instance=null)
Uses reflection to find a list of macros within the specified type by searching for (static) methods ...
Definition: MacroAttributes.cs:181
static ILNodePrinter?? Printer
Gets or sets the default node printer on the current thread, which controls how nodes are serialized ...
Definition: LNode.cs:520
override int GetHashCode()
Gets the hash code based on the structure of the tree.
Definition: LNode.cs:699
static NegList< T > AsNegList< T >(this IList< T > list, int zeroOffset)
Definition: NegList.cs:19
static IEnumerable< KeyValuePair< LNode, LNode > > GetOptions(LNodeList optionList)
Transforms an option list in the format option1(v1), option2(v2) or option1: v1, option2: v2 into a s...
Definition: IMacroContext.cs:218
new UString Slice(int startIndex, int length)
Returns a substring from the character source. If some of the requested characters are past the end o...
An implementation of the LLLPG Parser API, used with the LLLPG options inputSource and inputClass.
Definition: ParserSource.cs:31
virtual bool AddObserver(IAListTreeObserver< K, T > observer)
Attaches a tree observer to this object.
Definition: AListBase.cs:1146
Represents a priority queue, in which Pop() always returns the largest or smallest item.
Definition: Queue interfaces.cs:56
XfAction
Values that can be returned by the VListTransformer function that the user passes to the Transform me...
Definition: VListBlock.cs:1447
abstract override LNode Clone()
Creates a copy of the node. Since nodes are immutable, there is little reason for an end-user to call...
bool SetEquals(IEnumerable< T > other)
Definition: MSet.cs:294
virtual bool HasSimpleHeadWithoutPAttrs()
Returns true if this is not a call, or if the call's Target is an Id or a Literal,...
Definition: LNode.cs:736
void ScanIndent(bool skipSpaces=true)
Scans indentation at the beginning of a line and updates the IndentLevel and IndentString properties....
Definition: BaseILexer.cs:149
bool IsSubsetOf(InvertibleSet< T > other)
TODO NOT IMPLEMENTED Returns true if all items in this set are present in the other set.
Definition: InvertibleSet.cs:127
virtual long CountMemory(int sizeOfPair)
Measures the total size of all objects allocated to this collection, in bytes, including the size of ...
Definition: Map.cs:163
static void Success()
Short for Success("").
Definition: MiniTest.cs:329
A compact patricia trie that uses strings as keys.
Definition: CPStringTrie.cs:15
override LiteralNode WithValue(object value)
Creates a new literal node with a different Value than the current literal node.
Definition: AbstractNodes.cs:104
IPGTerminalSet EmptySet
Returns an empty set of the appropriate type for the kind of parser being generated by this code.
Definition: IPGCodeGenHelper.cs:29
Provides additional bit-oriented integer operations.
Definition: Interfaces.cs:178
Interface for an Optimize() method.
Definition: Other interfaces.cs:105
static bool IsVariableDeclExpr(LNode expr, out LNode type, out LNode name, out LNode initialValue, Pedantics p=Pedantics.Lax)
Verifies that a declaration of a single variable is valid, and gets its parts.
Definition: EcsValidators.cs:324
void ItemAdded(T item, AListLeafBase< K, T > parent)
Called when an item is added to a leaf node.
Definition: AListIndexer.cs:100
new void Newline()
Definition: LexerSource.cs:101
static readonly Symbol Implicit
e.g. [#implicit] #fn(#int32, [#operator] #cast, (Foo a,))
Definition: CodeSymbols.cs:182
void Print(IEnumerable< LNode > nodes, StringBuilder target, IMessageSink msgs=null, ParsingMode mode=null, ILNodePrinterOptions options=null)
Serializes a list of syntax trees to a StringBuilder in the syntax supported by this object.
Definition: Les2LanguageService.cs:43
Represents a mutable 2D rectangle.
Definition: IRectangle.cs:71
Adapter: a random-access range for a slice of an INegListSource<T>.
Definition: NegListSlice.cs:22
int LineToIndex(int lineNo)
Returns the index in a source file of the beginning of the specified line, where the first line is nu...
Definition: LineRemapper.cs:44
An all-purpose list structure with the following additional features beyond what's offered by List<T>...
Definition: AList.cs:122
static T LastOrDefault< T >(this IReadOnlyList< T > list, T defaultValue=default(T))
Gets the last item from the list (Count - 1), or defaultValue if the list is empty.
Definition: LinqToLists.out.cs:57
NodeScanMode
Specifies which children to enumerate when calling LNode.Descendants().
Definition: DescendantsFrame.cs:14
TValue GetIfExists(TKey key)
Gets the item with the specified key, if it was created earlier.
BMultiMap(Func< K, K, int > compareKeys)
Initializes the map with the specified key-comparer and default value comparer. This constructor can ...
Definition: BMultiMap.cs:67
A sparse list that supports additional methods including InsertRange(int, ISparseListSource<T>).
Definition: ISparseList.cs:206
static LNodeList PlusTrailingTrivia(this LNodeList attrs, LNodeList trivia)
Adds additional trailing trivia to an attribute list. Has no effect if trivia is empty.
Definition: LNodeExt.cs:94
void Sort(Comparer< T > comp)
Uses a specialized "tree quicksort" algorithm to sort this list using the specified Comparer<T>.
Definition: AList.cs:361
bool SetEquals(Set< T > other)
Definition: MSet.cs:288
VList< T > Add(T item)
Inserts an item at the back (index Count) of the VList.
Definition: VList.cs:375
bool IsProperSupersetOf(MSet< T > other)
Definition: MSet.cs:281
EscapeC
Flags to control PrintHelpers.EscapeCStyle(UString, EscapeC)and the reverse operation in ParseHelpers...
Definition: PrintHelpers.cs:233
override long CountSizeInBytes(int sizeOfT, int sizeOfK)
Tallies the memory use of the current node and all child nodes, with the assumption that each object ...
Definition: AListInnerBase.cs:36
virtual void Prepend(AList< T > other)
Prepends an AList to this list in sublinear time.
Definition: AList.cs:342
This priority queue wrapper type is returned from the AsMinHeap() extension method.
Definition: Heap.cs:300
bool IsProperSubsetOf(ISet< T > other)
Definition: Set.cs:153
MacroMode
Flags that affect the way that LeMP.MacroProcessor uses a LexicalMacro.
Definition: MacroAttributes.cs:81
Precedence(int actual)
Initializes a left-associative operator with the specified precedence.
Definition: Precedence.cs:225
Helper struct. A sequence that stores one value, but acts like a list in which that value is repeated...
Definition: Repeated.cs:38
int InputPosition
Current input position (an index into SourceFile.Text).
Definition: ILexer.cs:33
This interface is implemented by helper objects that handle the low-level details of node printing....
Definition: INodePrinterWriter.cs:17
static int AddRange< K, V >(this IDictionary< K, V > dict, IEnumerable< KeyValuePair< K, V >> list)
Adds data to a dictionary (dict.Add(key, value) for all pairs in a sequence.)
Definition: DictionaryExt.cs:137
bool Local
A local and-predicate cannot be hoisted into calling rules.
Definition: Predicates.cs:869
StringBuilder PrintToHtml(ILNode node, StringBuilder output=null, bool addPreCode=true)
Definition: Les3PrettyPrinter.cs:208
static readonly Symbol Case
e.g. #case(10, 20) <=> case 10, 20:
Definition: CodeSymbols.cs:142
bool SpaceAfterComma
Whether to print a space after each comma in an argument list.
Definition: Les3PrinterOptions.cs:56
int Do(AListOperation mode, T item)
Definition: BList.cs:190
@ TDQStringLiteral
Used for a triple-double-quoted string literal like """foo""".
@void.Value represents the sole value of System.Void (called "void" in C#).
Definition: void.cs:27
Holds the Count property found in nearly all collection interfaces.
Definition: ICount.cs:18
uint _eofPosition
_eofPosition is the byte position of EOF if it has been reached or, if not, the position of the first...
Definition: StreamCharSource.cs:70
virtual void Reset()
Forgets previously encountered operators to save memory.
Definition: LesPrecedenceMap.cs:28
Extension methods for Dictionary<K,V>, IDictionary<K,V> and IDictionaryEx<K, V>.
Definition: DictionaryExt.cs:9
List< int > IndexesOf(T item, bool sorted)
Returns a list of indexes at which the specified item can be found.
Definition: IndexedAList.cs:83
General-purpose code generator that supports any language with a finite number of input symbols repre...
Definition: GeneralCodeGenHelper.cs:27
int? DefaultArm
Specifies the case that should be encoded as the default in the prediction tree, i....
Definition: Predicates.cs:484
Base class of all nodes that represent literal values such as 123 and "foo".
Definition: AbstractNodes.cs:51
Provides trigonometry operations.
Definition: Interfaces.cs:218
Use this interface for types such as complex numbers that satisfy the field axioms but do not have a ...
Definition: Interfaces.cs:392
override string ChooseGotoLabel()
Optional. If this predicate represents the matching code for a branch of an Alts and this code is rea...
Definition: Predicates.cs:267
IListSource< LNode > Parse(ICharSource text, string fileName, IMessageSink msgs, IParsingOptions options)
Parses a source file into one or more Loyc trees.
Definition: Les2LanguageService.cs:62
Symbol TypeMarker
Represents the type of the value.
Definition: ILiteralValue.cs:39
Adapter: This class wraps an IEnumerator<T> or IEnumerable<T> into an IListSource<T>,...
Definition: BufferedSequence.cs:45
bool? Attach(AListBase< K, T > list)
Called when the observer is being attached to an AList.
Definition: AListNodeObserver.cs:57
static readonly Symbol PostDec
"suf--" Unary suffix decrement
Definition: CodeSymbols.cs:40
Definition: MacroProcessorTests.cs:112
Contains general-purpose interfaces (Loyc.Collections.IListSource<T>, ranges, etc....
Definition: Disambiguation interfaces.cs:6
Adapter: a wrapper of a list that provides a view of a range of elements. Objects of this type are re...
Definition: ListSlice.cs:36
static LNode GetCaptureIdentifier(LNode pattern, bool identifierRequired=true)
Checks if pattern matches one of the syntax trees $x or $(..x) or $(...x) for some identifier x....
Definition: LNodeExt.cs:509
static readonly Symbol Or
"||" Logical short-circuit 'or' operator
Definition: CodeSymbols.cs:43
static int IndexWhere< T >(this IEnumerable< T > list, Func< T, bool > pred)
Gets the lowest index at which a condition is true, or -1 if nowhere.
bool IsEmpty
Returns true if and only if Count == 0.
Definition: UString.cs:124
Main Loyc namespace. This namespace includes all general-purpose code in the Loyc megaproject....
Definition: Disambiguation interfaces.cs:6
static T LastOrDefault< T >(this IList< T > list, T defaultValue=default(T))
Gets the last item from the list (Count - 1), or defaultValue if the list is empty.
Definition: LinqToLists.out.cs:301
T Zero
Returns the "zero" or additive identity of this type.
Definition: Interfaces.cs:82
static void Sort< T >(T[] array, int index, int count, Comparison< T > comp)
Performs a quicksort using a Comparison function.
Definition: InternalList.cs:754
static ILexer< Token > Tokenize(this IParsingService parser, ICharSource text, string fileName, IMessageSink msgs=null)
Parses a string by invoking IParsingService.Tokenize(ICharSource, string, IMessageSink,...
Definition: IParsingService.cs:223
A dummy implementation of ISourceFile that has only a filename, no source text. Used as the source fi...
Definition: EmptySourceFile.cs:13
void InsertRange(int index, ISparseListSource< T > list)
Inserts another sparse list into this one.
static MinHeap< T > ToMinHeap< T >(this IList< T > list, IComparer< T > compare=null, bool heapify=true)
Copies the list into a new object with the items arranged as a min-heap (priority queue)....
Definition: Heap.cs:357
static R[] SelectArray< T, R >(this T[] input, Func< T, R > selector)
Maps an array to another array of the same length.
Definition: ListExt.cs:538
LNodeList SmartWhere(Func< LNode, bool > filter)
Filters the list, returning the same list if the filter function returns true for every item.
bool QuoteUnprintableLiterals
When the printer encounters an unprintable literal, it calls Value.ToString(). When this flag is set,...
Definition: EcsNodePrinter.cs:1349
static readonly Symbol NewAttribute
"#new": public new void Foo() {} <=> [#public, #new] #fn(#void, Foo, #(), {})
Definition: CodeSymbols.cs:102
static readonly Symbol Of
"'of" for giving generic arguments. @'of(List,int) <=> List<int>
Definition: CodeSymbols.cs:98
static bool operator==(FVList< T > lhs, FVList< T > rhs)
Returns whether the two list references are the same. Does not compare the contents of the lists.
Definition: FVList.cs:123
static T Last< T >(this IList< T > list)
Gets the last item from the list (at list.Max).
Definition: LinqToLists.out.cs:293
int _offset
_key[_offset] is the next byte of the key
Definition: CPTrieMisc.cs:133
static string IntegerToString(long value, string prefix="", int @base=10, int separatorInterval=3, char separatorChar='_')
Converts an integer to a string, optionally with separator characters for readability.
Definition: PrintHelpers.cs:163
ILineColumnFile IndexToLine(int index)
Returns the position in a source file of the specified index.
Definition: TokenListAsLexer.cs:73
BList< T > Clone(bool keepListChangingHandlers)
Clones a BList.
Definition: BList.cs:277
static readonly Symbol AddAssign
"'+=" add-and-set operator
Definition: CodeSymbols.cs:125
static int Run(object o)
Runs all test methods on the given object (public methods that have a TestAttribute).
Definition: RunTests.cs:27
override int Count
Number of items in the collection.
Definition: WeakKeyDictionary.cs:43
Workaround for a limitation of the debugger: it doesn't support CollectionDebugView<T> when T is KeyV...
Definition: CollectionDebugView.cs:51
Definition: TestUnrollMacro.cs:10
BaseLexer(CharSrc chars, string fileName="", int inputPosition=0, bool newSourceFile=true)
Initializes BaseLexer.
Definition: BaseLexer.cs:92
IndentTokenGenerator(ILexer< Token > lexer, int[] allIndentTriggers, Token? eolToken, Token indentToken, Token dedentToken)
Initializes the indent detector.
Definition: IndentTokenGenerator.cs:510
WordWrapCharType
The set of character categories recognized by overloads of G.WordWrap(string, int,...
Definition: G.cs:580
FVList< T > RemoveAt(int localCount, int distanceFromFront)
Removes the specified number of items from a FVList where localCount is the number of items in the FV...
Definition: VListBlock.cs:486
static LNode ToLNode(this ILNode node)
Converts ILNode to LNode recursively.
Definition: LNodeExt.cs:668
int RemoveWhere(Predicate< T > match)
Removes all elements that match the conditions defined by the specified predicate from this collectio...
Definition: MSet.cs:415
BList(Func< T, T, int > compareItems, int maxLeafSize)
Definition: BList.cs:70
static readonly Symbol Assign
"=" Assignment operator
Definition: CodeSymbols.cs:58
static readonly Symbol Unchecked
e.g. #unchecked({ stmt; }); <=> unchecked { stmt; }
Definition: CodeSymbols.cs:150
override VListBlock< T > Add(int localIndex, T item)
Inserts a new item at the "front" of a FVList where localCount is the number of items currently in th...
Definition: VListBlockOfTwo.cs:103
This interface is to be implemented by read-only sequence types that still want to be compatible with...
Definition: Disambiguation interfaces.cs:22
Base class for people that want to implement the visitor pattern with LNode.
Definition: LNodeVisitor.cs:9
Marks a method as a LeMP lexical macro.
Definition: MacroAttributes.cs:54
static LNode MergeBinary(LNode node1, LNode node2, Symbol binaryOpName)
Combines two nodes using a binary operator or function.
Definition: LNode.cs:798
bool _reachedEnd
Set true when the last block has been scanned. If true, then _eofIndex and _eofPosition indicate the ...
Definition: StreamCharSource.cs:62
ICollection< Symbol > PreOpenedNamespaces
Macros in these namespaces will be available without an explicit import command (#importMacros)....
Definition: MacroProcessor.cs:116
static void AddRange< K >(this ICollection< K > set, IEnumerable< K > list)
Adds data to a set (set.Add(value) for all values in a sequence.)
Definition: ICollectionExt.cs:13
static T[] ToArray(VListBlock< T > self, int localCount, bool isRList)
Converts any kind of FVList to an array, quickly.
Definition: VListBlock.cs:1041
virtual void Begin(WList< LNode > classBody, ISourceFile sourceFile)
Before the parser generator generates code, it calls this method.
Definition: CodeGenHelperBase.cs:131
int SpaceAfterPrefixStopPrecedence
The printer avoids printing spaces after prefix operators that have the specified precedence or highe...
Definition: EcsNodePrinter.cs:1379
This interface is meant to be implemented by read-only sequence classes that originally implemented I...
Definition: Disambiguation interfaces.cs:49
WList< T > ToWList()
Returns this list as a WList, which effectively reverses the order of the elements.
Definition: FVList.cs:249
bool IsRightAssociative
Returns true if this object represents a right-associative operator such as equals (x = (y = z)),...
Definition: Precedence.cs:268
MMap< K, V > Without(K key)
Definition: MMap.cs:262
@ OctalLiteral
Used for an octal (base-7) literal like 0o37.
virtual void Append(SparseAList< T > other, bool move)
Definition: SparseAList.cs:194
This helper class gives a nice view of a custom collection within the debugger.
Definition: CollectionDebugView.cs:86
static void StableSort< T >(this IList< T > list, Comparison< T > comp)
Performs a stable sort, i.e. a sort that preserves the relative order of items that compare equal.
Definition: ListExt.cs:313
static MinHeapInList< T > AsMinHeap< T >(this IList< T > list, IComparer< T > compare=null, bool heapify=false)
Returns a MinHeapInList wrapper object, which treats the list as a binary min-heap (priority queue)....
Definition: Heap.cs:343
static IListSource< LNode > Parse(this IParsingService parser, UString input, IMessageSink msgs=null, ParsingMode inputType=null, bool preserveComments=true)
Parses a string by invoking IParsingService.Parse(ICharSource, string, IMessageSink,...
Definition: IParsingService.cs:229
An interface that encapsulates the lexer and parser of a programming language, or a non-programming l...
Definition: IParsingService.cs:26
bool SurfaceScanOnly
Indicates that the parsing service is only being used for syntax highlighting, so the content of lite...
Definition: IParsingOptions.cs:24
T NextHigherItem(ref int? index)
Increases index by at least one to reach the next index that is not classified as empty space,...
static void PreserveStackTrace(this Exception exception)
Calls an internal method of Exception that records an exception's stack trace so that the stack trace...
Definition: Extensions.cs:175
LNode TerminalType
The type returned from Match() methods.
Definition: CodeGenHelperBase.cs:60
static FVList< T > Transform(VListBlock< T > _block, int _localCount, VListTransformer< T > x, bool isRList, WListProtected< T > forWList)
Transforms a list (combines filtering with selection and more).
Definition: VListBlock.cs:1271
Contains global functions that don't belong in any specific class.
Definition: G.cs:21
static readonly Symbol ForEach
e.g. #foreach(#var(@``, n), list, {...}); <=> foreach(var n in list) {...}
Definition: CodeSymbols.cs:140
virtual Pred Clone()
Deep-clones a predicate tree. Terminal sets and Nodes referenced by the tree are not cloned; the clon...
Definition: Predicates.cs:177
static bool TryParseInt(ref UString s, out int result, int radix=10, ParseNumberFlag flags=0)
Definition: ParseHelpers.cs:265
T PopAndPush(T item)
Combines a pop followed by a push into one operation that is more efficient than a separate Pop nad P...
Definition: Heap.cs:127
Map< K, V > With(K key, V value, bool replaceIfPresent=true)
Returns a copy of the current map with an additional key-value pair.
Definition: Map.cs:275
A concrete class that users can pass to an LNodePrinter.
Definition: LNodePrintingOptions.cs:9
ILexer< Token > Tokenize(ICharSource text, string fileName, IMessageSink msgs, IParsingOptions options)
Returns a lexer that is configured to begin reading the specified file.
abstract LNodeList GetTriviaToAttach(LNode node, IListSource< Trivia > trivia, TriviaLocation loc, LNode parent, int indexInParent)
Derived class translates a list of trivia (tokens) into appropriate trivia attributes....
DList< Token > TriviaList
A list of saved trivia: comments, newlines, preprocessor directives and ignored regions.
Definition: EcsPreprocessor.cs:62
abstract FVList< T > Prior
Returns a FVList representing the tail of the chain of VListBlocks.
Definition: VListBlock.cs:274
Definition: TestMacroCombinations.cs:10
static readonly Symbol ArrayInit
C# e.g. int[] x = {1,2} <=> int[] x = #arrayInit(1, 2)
Definition: CodeSymbols.cs:192
A compact auto-enlarging deque structure that is intended to be used within other data structures....
Definition: InternalDList.cs:69
VListBlock< T > AddRange(FVList< T > front, FVList< T > back)
Appends a range of items to the "front" of this block.
Definition: VListBlock.cs:565
static readonly Symbol AndBits
"&" Bitwise and operator. Also, address-of (unary &)
Definition: CodeSymbols.cs:62
bool IsSubsetOf(ISet< T > other, int myMinCount)
Returns true if all items in this set are present in the other set.
Definition: InternalSet.cs:1469
MMap< object, object > DefaultScopedProperties
Default values of scoped properties.
Definition: MacroProcessor.cs:134
List< Pair< int, uint > > _blkOffsets
A sorted list of mappings between byte positions and character indexes. In each Pair(of A,...
Definition: StreamCharSource.cs:58
Base class to help you implement the standard IEnumerator{T} interface. All you have to do is overrid...
Definition: EnumeratorBase.cs:11
static LNodeList Unsplice(this LNode node)
Converts an expression to a list. Similar to calling AsList(block, CodeSymbols.Splice),...
Definition: LNodeExt.cs:135
Represents a mutable 3D rectangle.
Definition: IRectangle3.cs:89
virtual UString TextValue
If this node IsLiteral, gets the original text of the literal, if it is available....
Definition: LNode.cs:346
delegate LNode LexicalMacro(LNode node, IMacroContext context)
Method signature of an LeMP macro.
Definition: Predicates.cs:939
@ SkipSingleQuotes
Skip single quotes inside number. Without this flag, single quotes make parsing stop.
T TryGet(int index, out bool fail)
Definition: NegListSource.cs:87
static double TryParseDouble(ref UString source, int radix, ParseNumberFlag flags=0)
Parses a string to a double-precision float, returning NaN on failure or an infinity value on overflo...
Definition: ParseHelpers.cs:558
NodeStyle Style
8 bits of nonsemantic information about the token. The style is used to distinguish hex literals from...
Definition: Token.cs:351
static string ToString(Token t, ICharSource sourceCode)
Expresses a token as a string, using LES printers for identifiers and literals.
Definition: TokenType.cs:65
int RemoveRange(IEnumerable< T > e)
Removes a set of items from the list, one at a time.
Definition: BList.cs:224
static object Cache(object o)
Passes the object through a thread-static instance of SimpleCache<o>.
Definition: CG.cs:24
bool ObeyRawText
When this flag is set, raw text trivia attributes (e.g. CodeSymbols.TriviaRawTextBefore) are obeyed (...
Definition: EcsNodePrinter.cs:1344
static string Description(this Exception ex, bool addStackTrace, string lineSeparator="\n\n")
Gets a description of the exception in the form "{ex.Message} ({ex.GetType().Name})"....
Definition: Extensions.cs:77
new T X
Horizontal coordinate of a point or vector.
Definition: IPoint.cs:31