Skip to content

Concatenate string literals in lex mod #3

Description

@GoogleCodeExporter
Greetings!

I am using ucpp as c preprocessor and part of lexer in my hobby c compiler
project. I just find that in lexer mod ucpp emits string literals
seperately instead of concatenate them automatically as what has described
by standard. For example,

char string[] = "hello" "world";

invoking lex() once will only yield first string token with value "hello",
next invoke of lex will emit "world". I thought as a preprocessor it should
concatnate string values and yield a single string literal token "hello
world", right?

Other examples include carriage return or line feed in between string
literals.. for example,

char string[] = "hello" \r \n "world" (you get the idea right:) while I
tried VC preprocessor it produce a single literal while ucpp lex produce
several tokens.

My question is, is there any approach that I can configure ucpp such that
at runtime it automatically concatenate string literals for me in lex mod?
Of course I can work around this in my lexer but I would like to know if my
question has a yes anwser - that will make my life easier..

Thanks a lot for reading my post so far :)

Original issue reported on code.google.com by liangha...@gmail.com on 10 Dec 2009 at 2:47

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions