Skip to content

Token: Implement is_keyword() and is_operator() methods #3

@pdaxt

Description

@pdaxt

Component

Foundation / Token

Task

Implement helper methods for TokenKind.

Acceptance Criteria

  • is_keyword() -> bool
  • is_operator() -> bool
  • is_literal() -> bool
  • precedence() -> Option<u8> for operators
  • All methods are const fn where possible

Verify

assert!(TokenKind::Fn.is_keyword());
assert!(TokenKind::Plus.is_operator());
assert!(TokenKind::Int(0).is_literal());

Security Testing (REQUIRED)

  • Test all enum variants exhaustively
  • Verify no panics on any valid input
  • Test edge cases (EOF, Error variants)
  • Ensure methods work in const context

Ref: FOUNDATION.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    foundationFoundation tier componentstokenToken component

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions