question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Grammar doesn't handle multiline preprocessor declarations

See original GitHub issue

Tried to parse tree-sitter’s parser.h and you get errors since the \ is misinterpreted as a preprocessor argument.

Output:

     comment /*
 *  Lexer Macros
 */
     preproc_function_def
      identifier START_LEXER
      preproc_params ()
      preproc_arg            \           <====
     declaration
      primitive_type bool
      init_declarator
       identifier result
       false false
     ERROR                               <====
      ERROR \
     declaration
      primitive_type int32_t
      identifier lookahead
     ERROR
      ERROR \
     labeled_statement
      statement_identifier next_state
      ERROR
       ERROR \
      expression_statement
       assignment_expression
        identifier lookahead
        field_expression
         identifier lexer
         field_identifier lookahead

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
genotrancecommented, Nov 20, 2018

Never mind - my mistake - looks like I had an old build for cpp still. Apologies.

1reaction
maxbrunsfeldcommented, Nov 16, 2018

Fixed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

c++ - Multiline preprocessor macro with trailing comments
The problem is that the c-preprocessor just adds another line ending character when the \ is hit and continuated.
Read more >
The C Preprocessor - Math
A header file is a file containing C declarations and macro definitions (see section Macros) to be shared between several source files.
Read more >
The NASM Preprocessor - NASM - The Netwide Assembler
In this step, the following preprocessor directives are processed: Multi-line macro definitions, specified by the %macro and %imacro directives.
Read more >
The C Preprocessor: Macros
Macros. A macro is a fragment of code which has been given a name. Whenever the name is used, it is replaced by...
Read more >
Use multi-line arguments to macros without commas with a ...
Hello, I just thought about the option to use multi-line statements for macro calls without the need to use comma in them. So...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found