---
name: "AtteanX::API::Lexer"
section: "3pm"
platform: "linux"
package: "libattean-perl"
version: "0.035-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/AtteanX::API::Lexer"
---

# AtteanX::API::Lexer(3pm)

Role defining common functionality for lexers.

## NAME

AtteanX::API::Lexer - Role defining common functionality for lexers.

## VERSION

This document describes AtteanX::API::Lexer version 0.035

## DESCRIPTION

The AtteanX::API::Lexer role provides a common interface and implementation for lexer implementations, allowing line-based buffer filling, and consuming of characters, constant strings, and fixed-length buffers.

## ATTRIBUTES

- "file"

  - "linebuffer"

  - "line"

  - "column"

  - "buffer"

  - "start\_column"

  - "start\_line"

  ## METHODS

- "fill\_buffer"

  Fills the buffer with a new line from the underlying filehandle.

- "check\_for\_bom"

  Remove a BOM character if one appears at the start of the buffer.

- get\_char\_safe( $char )

  Consume the single character `$char` from the buffer. Throw an error if `$char` is not at the start of the buffer.

- get\_char( $char )

  Consume and return a single character from the buffer.

- peek\_char( $char )

  Return a single character from the start of the buffer.

- read\_word( $word )

  Consume the string `$word` from the start of the buffer. Throw an error if `$word` is not at the start of the buffer.

- read\_length( $length )

  Consume and return `$length` characters  from the start of the buffer.

## BUGS

Please report any bugs or feature requests to through the GitHub web interface at \<https://github.com/kasei/attean/issues\>.

## SEE ALSO

## AUTHOR

Gregory Todd Williams  `"<gwilliams@cpan.org>"`

## COPYRIGHT

Copyright (c) 2014--2022 Gregory Todd Williams. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
