Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lexer: allow TABS for indentation #2392

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Apr 22, 2024

  1. lexer: allow TABS for indentation

    Allow TAB character to be used for indentation.
    
    This is useful to have TAB character used as indentation, especially when
    parts of build.ninja are hand-written as HEREDOCs in otherwise
    TAB-indented file (either mandated by style for other part of project, or
    required by language itself).
    
    Changing lexer is easy thanks to the use of re2c, syntax is perhaps a bit
    too permissive now, but that is job of the parser to reject use of mixed
    indentation.
    
    Let's stop complaining that:
    ninja: error: build.ninja:3: expected 'command =' line
    when it is exactly:
    	command = cc $cflags -c $in -o $out
    
    tests: print string instead of int for Lexer::Token
    
    Extend C++ tests by a wrapper for Lexer::Token printing, to have string
    value reported instead of numeric value, that gives "newline" instead of
    "8" in test results.
    Original line numbers are kept in error messages as they were before.
    
    Extend python functional test to have TABs used in both variable and build
    statements.
    
    Closes ninja-build#1598
    Signed-of-by: Przemek Kitszel <[email protected]>
    pkitszel committed Apr 22, 2024
    Configuration menu
    Copy the full SHA
    07b6f9f View commit details
    Browse the repository at this point in the history