From a09d58b1c7ffdf2814af87b382061744051d997b Mon Sep 17 00:00:00 2001 From: Trevor Maze Date: Wed, 18 Feb 2026 21:43:53 -0500 Subject: [PATCH] One-line comment support --- Sources/rxcc/rxcc.swift | 3 ++- test.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Sources/rxcc/rxcc.swift b/Sources/rxcc/rxcc.swift index 0c2e0d5..ace3949 100644 --- a/Sources/rxcc/rxcc.swift +++ b/Sources/rxcc/rxcc.swift @@ -655,7 +655,8 @@ struct rxcc { } func lex(string: String) -> [Substring] { - var line = string.replacing("\n", with: " ") + var line = string.replacing(/\/\/.*\n/, with: "") + line = line.replacing("\n", with: " ") line = line.replacing("\t", with: " ") line = line.replacing("{", with: " { ") line = line.replacing("}", with: " } ") diff --git a/test.c b/test.c index 68430eb..a888c35 100644 --- a/test.c +++ b/test.c @@ -1,4 +1,5 @@ int main() { + // Comment int tomas = 8; tomas /= 2; tomas *= 3; @@ -8,7 +9,7 @@ int main() { tomas += 31; tomas &= 21; tomas |= 3; - tomas |= 303; + tomas |= 303; //hi tomas ^= 23; tomas ^= 27; tomas &= 302;