From 89b5cb358a13e7229487fe3c22785942d329b018 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Mon, 7 Aug 2006 05:37:32 +0000 Subject: Updated the lexer to not include + or = in string literals outside of quotes. Added the new make style viewer, the simplest, lamest viewer, but it looks just like the output of make. Very useful for debugging and seeing what's going on. --- src/build.l | 4 ++-- src/main.cpp | 9 ++++++++ src/viewermake.cpp | 62 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/viewermake.h | 28 ++++++++++++++++++++++++ 4 files changed, 101 insertions(+), 2 deletions(-) create mode 100644 src/viewermake.cpp create mode 100644 src/viewermake.h (limited to 'src') diff --git a/src/build.l b/src/build.l index 723991b..2b834a2 100644 --- a/src/build.l +++ b/src/build.l @@ -77,12 +77,12 @@ std::string strbuf; "#".* /* single line comment */ -[^ \t\r\n\'\":=,/][^ \t\r\n\'\":=,]* { +[^ \t\r\n\'\":+=,/][^ \t\r\n\'\":+=,]* { yylval->strval = stringdup( yytext ); return STRING; } -[^ \t\r\n\'\":=,/][^ \t\r\n\'\"=,]+[^ \t\r\n\'\":=,] { +[^ \t\r\n\'\":+=,/][^ \t\r\n\'\"+=,]+[^ \t\r\n\'\":+=,] { yylval->strval = stringdup( yytext ); return STRING; } diff --git a/src/main.cpp b/src/main.cpp index 3ea4411..c1df482 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,6 +1,7 @@ #include "builder.h" #include "viewerplain.h" #include "viewerpercent.h" +#include "viewermake.h" #include "paramproc.h" #include "staticstring.h" @@ -17,6 +18,8 @@ public: "Set the input script, default: build.conf"); addParam('p', mkproc(Param::procViewPercent), "Switch to percent view."); + addParam('m', mkproc(Param::procViewMake), + "Switch to 'make' style view."); addParam("cache", &sCache, "Set an alternative cache file." ); addParam('d', &bDebug, @@ -48,6 +51,12 @@ public: pViewer = new ViewerPercent; } + int procViewMake( int argc, char *argv[] ) + { + delete pViewer; + pViewer = new ViewerMake; + } + std::string sCache; std::string sFile; StaticString sAction; diff --git a/src/viewermake.cpp b/src/viewermake.cpp new file mode 100644 index 0000000..7f63552 --- /dev/null +++ b/src/viewermake.cpp @@ -0,0 +1,62 @@ +#include +#include "viewermake.h" +#include "perform.h" + +ViewerMake::ViewerMake() +{ +} + +ViewerMake::~ViewerMake() +{ +} + +void ViewerMake::beginTarget( const char *sName, const char *sType, const char *sOperation, int nPerforms ) +{ + //sAction = sName; + //bPrinted = false; +} + +void ViewerMake::printHead() +{ + /* + if( bPrinted == false ) + { + printf("--- %s ---\n", sAction.getString() ); + bPrinted = true; + }*/ +} + +void ViewerMake::endTarget() +{ + /*if( bPrinted == true ) + { + printf("\n"); + } + else + { + printf("Nothing to be done for %s.\n", sAction.getString() ); + }*/ +} + +void ViewerMake::beginPerform( Perform *pPerf ) +{ + //sTarget = pPerf->getTarget(); +} + +void ViewerMake::beginExtraRequiresCheck( const char *sCommand ) +{ + //printHead(); + //printf(" check: %s\n", sTarget.getString() ); +} + +void ViewerMake::beginExecute() +{ + //printHead(); + //printf(" build: %s\n", sTarget.getString() ); +} + +void ViewerMake::executeCmd( const char *sCmd ) +{ + printf("%s\n", sCmd ); +} + diff --git a/src/viewermake.h b/src/viewermake.h new file mode 100644 index 0000000..767d0bd --- /dev/null +++ b/src/viewermake.h @@ -0,0 +1,28 @@ +#ifndef VIEWER_MAKE_H +#define VIEWER_MAKE_H + +#include + +#include "viewer.h" +#include "staticstring.h" + +class ViewerMake : public Viewer +{ +public: + ViewerMake(); + virtual ~ViewerMake(); + + virtual void beginTarget( const char *sName, const char *sType, const char *sOperation, int nPerforms ); + virtual void endTarget(); + + virtual void beginPerform( Perform *pPerf ); + virtual void beginExtraRequiresCheck( const char *sCommand ); + void printHead(); + virtual void beginExecute(); + virtual void executeCmd( const char *sCmd ); + +private: + +}; + +#endif -- cgit v1.2.3