Skip to content
This repository has been archived by the owner on Feb 4, 2025. It is now read-only.

Commit

Permalink
Merge pull request #437 from hdamron17/preprocessor-whitespace
Browse files Browse the repository at this point in the history
Close #356 - Add whitespace token for preprocessor
  • Loading branch information
jyn514 authored May 25, 2020
2 parents 5afd5ac + 23bc8a1 commit 1d2ffce
Show file tree
Hide file tree
Showing 9 changed files with 288 additions and 69 deletions.
6 changes: 6 additions & 0 deletions src/data/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,12 @@ pub enum CppError {
#[error("expected expression for #if")]
EmptyExpression,

#[error("macro name missing")]
ExpectedMacroId,

#[error("missing {0} in {1}")]
Expected(&'static str, &'static str),

/// A `#define` occured without an identifier following.
#[error("macro name missing")]
EmptyDefine,
Expand Down
4 changes: 4 additions & 0 deletions src/data/lex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@ pub enum Token {
Literal(Literal),
Id(InternedStr),

Whitespace(String),

// Misc
Ellipsis,
StructDeref, // ->
Expand Down Expand Up @@ -353,6 +355,8 @@ impl std::fmt::Display for Token {
Id(id) => write!(f, "{}", id),
Keyword(k) => write!(f, "{}", k),

Whitespace(s) => write!(f, "{}", s),

Ellipsis => write!(f, "..."),
StructDeref => write!(f, "->"),
Hash => write!(f, "#"),
Expand Down
Loading

0 comments on commit 1d2ffce

Please sign in to comment.