/// <summary> /// Parses the keyword «\space». /// </summary> private void ParseSpace(ParagraphElements elements, int nestingLevel) { // Samples // \space // \space(5) // \space(em) // \space(em,5) AssertSymbol(Symbol.Space); Character space = elements.AddSpace(1); // «\space» can stand alone if (_scanner.PeekSymbol() == Symbol.ParenLeft) { ReadCode(); // read '(' AssertSymbol(Symbol.ParenLeft); ReadCode(); // read beyond '(' if (Symbol == Symbol.Identifier) { string type = Token; if (!IsSpaceType(type)) ThrowParserException(DomMsgID.InvalidEnum, type); space.SymbolName = (SymbolName)Enum.Parse(typeof(SymbolName), type, true); ReadCode(); // read ',' or ')' if (Symbol == Symbol.Comma) { ReadCode(); // read integer AssertSymbol(Symbol.IntegerLiteral); space.Count = _scanner.GetTokenValueAsInt(); ReadCode(); // read ')' } } else if (Symbol == Symbol.IntegerLiteral) { space.Count = _scanner.GetTokenValueAsInt(); ReadCode(); } AssertSymbol(Symbol.ParenRight); } }