Skip to main content

parse

Function parse 

Source
pub fn parse(data: &[u8]) -> Result<TokenStream, TokenError>
Expand description

Parses a tokenized AutoIt (EA06) script into a TokenStream.

Reads the leading little-endian u32 line count, then loops reading opcode-prefixed tokens until that many line-end markers have been seen. Each line-end opcode increments the completed-line counter and pushes a Token::LineEnd; every other opcode is decoded into its token.

§Arguments

  • data - The raw tokenized script bytes, starting with the line count.

§Returns

A TokenStream holding the declared line count and all parsed tokens.

§Errors

Returns TokenError::Truncated if the input ends before a required field can be read, or if the completed-line counter would overflow. Returns TokenError::BadString if a string token’s length prefix or XOR-keyed UTF-16 code units are malformed.