lexer

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 1, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package lexer scans SystemVerilog/Verilog source text into a token stream (see the sibling token package for the vocabulary). It is error-tolerant by design: unrecognized input never stops scanning or panics, it's tagged token.KindInvalid and lexing continues, since a language server has to make sense of source that's broken mid-edit far more often than a batch tool does.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Line      int
	Character int
	Message   string
}

Error is a non-fatal problem noticed while lexing (an unrecognized character, an unterminated comment or string). Lex never stops or panics because of one -- Errors accumulates them for a caller to surface as diagnostics if it wants to.

func Lex

func Lex(src string) ([]token.Token, []Error)

Lex tokenizes src in full. The returned token slice always ends with exactly one token.KindEOF token, so a caller (a future parser, chiefly) never needs a separate end-of-input check.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL