PDFsharp-net6

CLexer

Namespace: PdfSharp.Pdf.Content

Lexical analyzer for PDF content files. Adobe specifies no grammar, but it seems that it is a simple post-fix notation.

public class CLexer

Inheritance ObjectCLexer

Properties

Symbol

Gets or sets the current symbol.

public CSymbol Symbol { get; set; }

Property Value

CSymbol

Token

Gets the current token.

public string Token { get; }

Property Value

String

ContLength

Gets the length of the content.

public int ContLength { get; }

Property Value

Int32

Position

Gets or sets the position in the content.

public int Position { get; set; }

Property Value

Int32

Constructors

CLexer(Byte[])

Initializes a new instance of the Lexer class.

public CLexer(Byte[] content)

Parameters

content Byte[]

CLexer(MemoryStream)

Initializes a new instance of the Lexer class.

public CLexer(MemoryStream content)

Parameters

content MemoryStream

Methods

ScanNextToken()

Reads the next token and returns its type.

public CSymbol ScanNextToken()

Returns

CSymbol

ScanComment()

Scans a comment line. (Not yet used, comments are skipped by lexer.)

public CSymbol ScanComment()

Returns

CSymbol

ScanInlineImage()

Scans the bytes of an inline image. NYI: Just scans over it.

public CSymbol ScanInlineImage()

Returns

CSymbol

ScanName()

Scans a name.

public CSymbol ScanName()

Returns

CSymbol

ScanDictionary()

Scans the dictionary.

protected CSymbol ScanDictionary()

Returns

CSymbol

ScanNumber()

Scans an integer or real number.

public CSymbol ScanNumber()

Returns

CSymbol

ScanOperator()

Scans an operator.

public CSymbol ScanOperator()

Returns

CSymbol

ScanLiteralString()

Scans a literal string.

public CSymbol ScanLiteralString()

Returns

CSymbol

ScanHexadecimalString()

Scans a hexadecimal string.

public CSymbol ScanHexadecimalString()

Returns

CSymbol

ScanNextChar()

Move current position one character further in content stream.

internal char ScanNextChar()

Returns

Char

AppendAndScanNextChar()

Appends current character to the token and reads next one.

internal char AppendAndScanNextChar()

Returns

Char

MoveToNonWhiteSpace()

If the current character is not a white space, the function immediately returns it. Otherwise, the PDF cursor is moved forward to the first non-white space or EOF. White spaces are NUL, HT, LF, FF, CR, and SP.

public char MoveToNonWhiteSpace()

Returns

Char

IsWhiteSpace(Char)

Indicates whether the specified character is a content stream white-space character.

internal static bool IsWhiteSpace(char ch)

Parameters

ch Char

Returns

Boolean

IsOperatorChar(Char)

Indicates whether the specified character is an content operator character.

internal static bool IsOperatorChar(char ch)

Parameters

ch Char

Returns

Boolean

IsDelimiter(Char)

Indicates whether the specified character is a PDF delimiter character.

internal static bool IsDelimiter(char ch)

Parameters

ch Char

Returns

Boolean