[cfe-commits] r38802 - in /cfe/cfe/trunk: Driver/clang.cpp Makefile Parse/ Parse/Actions.cpp Parse/Makefile Parse/Parser.cpp clang.xcodeproj/project.pbxproj include/clang/Basic/DiagnosticKinds.def include/clang/Parse/ include/clang/Parse/Action.h include/clang/Parse/Parser.h

sabre at cs.uiuc.edu sabre at cs.uiuc.edu
Wed Jul 11 09:24:46 PDT 2007


Author: sabre
Date: Wed Jul 11 11:24:45 2007
New Revision: 38802

URL: http://llvm.org/viewvc/llvm-project?rev=38802&view=rev
Log:
initial support for parsing, right now just ;'s at the top level, but this
adds most simple scaffolding.

Added:
    cfe/cfe/trunk/Parse/
    cfe/cfe/trunk/Parse/Actions.cpp   (with props)
    cfe/cfe/trunk/Parse/Makefile   (with props)
    cfe/cfe/trunk/Parse/Parser.cpp   (with props)
    cfe/cfe/trunk/include/clang/Parse/
    cfe/cfe/trunk/include/clang/Parse/Action.h   (with props)
    cfe/cfe/trunk/include/clang/Parse/Parser.h   (with props)
Modified:
    cfe/cfe/trunk/Driver/clang.cpp
    cfe/cfe/trunk/Makefile
    cfe/cfe/trunk/clang.xcodeproj/project.pbxproj
    cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def

Modified: cfe/cfe/trunk/Driver/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Driver/clang.cpp?rev=38802&r1=38801&r2=38802&view=diff

==============================================================================
--- cfe/cfe/trunk/Driver/clang.cpp (original)
+++ cfe/cfe/trunk/Driver/clang.cpp Wed Jul 11 11:24:45 2007
@@ -23,7 +23,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "clang.h"
-#include "clang/Lex/Preprocessor.h"
+#include "clang/Parse/Parser.h"
 #include "clang/Basic/Diagnostic.h"
 #include "clang/Basic/FileManager.h"
 #include "clang/Basic/SourceBuffer.h"
@@ -45,13 +45,16 @@
 Stats("stats", cl::desc("Print performance metrics and statistics"));
 
 enum ProgActions {
+  ParsePrintCallbacks,          // Parse and print each callback.
+  ParseNoop,                    // Parse with noop callbacks.
   RunPreprocessorOnly,          // Just lex, no output.
   PrintPreprocessedInput,       // -E mode.
   DumpTokens                    // Token dump mode.
 };
 
 static cl::opt<ProgActions> 
-ProgAction(cl::desc("Choose output type:"), cl::ZeroOrMore,cl::init(DumpTokens),
+ProgAction(cl::desc("Choose output type:"), cl::ZeroOrMore,
+           cl::init(ParseNoop),
            cl::values(
              clEnumValN(RunPreprocessorOnly, "Eonly",
                         "Just run preprocessor, no output (for timings)"),
@@ -59,6 +62,11 @@
                         "Run preprocessor, emit preprocessed file"),
              clEnumValN(DumpTokens, "dumptokens",
                         "Run preprocessor, dump internal rep of tokens"),
+             clEnumValN(ParsePrintCallbacks, "parse-print-callbacks",
+                        "Run parser and print each callback invoked"),
+             clEnumValN(ParseNoop, "parse-noop",
+                        "Run parser with noop callbacks (for timings)"),
+             // TODO: NULL PARSER.
              clEnumValEnd));
 
 
@@ -598,6 +606,25 @@
   // FIXME: IMPLEMENT
 }
 
+//===----------------------------------------------------------------------===//
+// Parser driver
+//===----------------------------------------------------------------------===//
+
+static void ParseFile(Preprocessor &PP, ParserActions *PA, unsigned MainFileID){
+  Parser P(PP, *PA);
+
+  PP.EnterSourceFile(MainFileID, 0, true);
+  
+  // Prime the lexer look-ahead.
+  P.ConsumeToken();
+  
+  P.ParseTranslationUnit();
+
+  // Start parsing the specified input file.
+
+  
+  delete PA;
+}
 
 //===----------------------------------------------------------------------===//
 // Main driver
@@ -692,31 +719,37 @@
   }
   
   switch (ProgAction) {
-  case RunPreprocessorOnly: {        // Just lex as fast as we can, no output.
+  case DumpTokens: {                 // Token dump mode.
     LexerToken Tok;
     // Start parsing the specified input file.
     PP.EnterSourceFile(MainFileID, 0, true);
     do {
       PP.Lex(Tok);
+      PP.DumpToken(Tok, true);
+      std::cerr << "\n";
     } while (Tok.getKind() != tok::eof);
     break;
   }
-    
-  case PrintPreprocessedInput:       // -E mode.
-    DoPrintPreprocessedInput(MainFileID, PP, Options);
-    break;
-                  
-  case DumpTokens: {                 // Token dump mode.
+  case RunPreprocessorOnly: {        // Just lex as fast as we can, no output.
     LexerToken Tok;
     // Start parsing the specified input file.
     PP.EnterSourceFile(MainFileID, 0, true);
     do {
       PP.Lex(Tok);
-      PP.DumpToken(Tok, true);
-      std::cerr << "\n";
     } while (Tok.getKind() != tok::eof);
     break;
   }
+    
+  case PrintPreprocessedInput:       // -E mode.
+    DoPrintPreprocessedInput(MainFileID, PP, Options);
+    break;
+
+  case ParseNoop:                    // -parse-noop
+    ParseFile(PP, new ParserActions(), MainFileID);
+    break;
+  case ParsePrintCallbacks:
+    //ParseFile(PP, new ParserPrintActions(PP), MainFileID);
+    break;
   }
   
   if (Stats) {

Modified: cfe/cfe/trunk/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Makefile?rev=38802&r1=38801&r2=38802&view=diff

==============================================================================
--- cfe/cfe/trunk/Makefile (original)
+++ cfe/cfe/trunk/Makefile Wed Jul 11 11:24:45 2007
@@ -1,11 +1,11 @@
 LEVEL = ../..
-PARALLEL_DIRS := Basic Lex
+PARALLEL_DIRS := Basic Lex Parse
 CPPFLAGS += -I$(LEVEL)/tools/clang/include
 
 CXXFLAGS = -fno-rtti -fno-exceptions
 
 TOOLNAME = clang
 
-USEDLIBS = clangLex.a clangBasic.a LLVMSupport.a LLVMSystem.a
+USEDLIBS = clangParse.a clangLex.a clangBasic.a LLVMSupport.a LLVMSystem.a
 
 include $(LEVEL)/Makefile.common

Added: cfe/cfe/trunk/Parse/Actions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/Actions.cpp?rev=38802&view=auto

==============================================================================
--- cfe/cfe/trunk/Parse/Actions.cpp (added)
+++ cfe/cfe/trunk/Parse/Actions.cpp Wed Jul 11 11:24:45 2007
@@ -0,0 +1,18 @@
+//===--- ParserActions.cpp - C Language Family Default Parser Actions -----===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by Chris Lattner and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+//  This file implements the default ParserActions method (which are noops).
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Parse/ParserActions.h"
+using namespace llvm;
+using namespace clang;
+
+

Propchange: cfe/cfe/trunk/Parse/Actions.cpp

------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/cfe/trunk/Parse/Actions.cpp

------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: cfe/cfe/trunk/Parse/Makefile
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/Makefile?rev=38802&view=auto

==============================================================================
--- cfe/cfe/trunk/Parse/Makefile (added)
+++ cfe/cfe/trunk/Parse/Makefile Wed Jul 11 11:24:45 2007
@@ -0,0 +1,22 @@
+##===- clang/Parse/Makefile --------------------------------*- Makefile -*-===##
+# 
+#                     The LLVM Compiler Infrastructure
+#
+# This file was developed by Chris Lattner and is distributed under
+# the University of Illinois Open Source License. See LICENSE.TXT for details.
+# 
+##===----------------------------------------------------------------------===##
+#
+#  This implements the Lexer library for the C-Language front-end.
+#
+##===----------------------------------------------------------------------===##
+
+LEVEL = ../../..
+LIBRARYNAME := clangParse
+BUILD_ARCHIVE = 1
+CXXFLAGS = -fno-rtti -fno-exceptions
+
+CPPFLAGS += -I$(LEVEL)/tools/clang/include
+
+include $(LEVEL)/Makefile.common
+

Propchange: cfe/cfe/trunk/Parse/Makefile

------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/cfe/trunk/Parse/Makefile

------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: cfe/cfe/trunk/Parse/Parser.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/Parse/Parser.cpp?rev=38802&view=auto

==============================================================================
--- cfe/cfe/trunk/Parse/Parser.cpp (added)
+++ cfe/cfe/trunk/Parse/Parser.cpp Wed Jul 11 11:24:45 2007
@@ -0,0 +1,81 @@
+//===--- Parser.cpp - C Language Family Parser ----------------------------===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by Chris Lattner and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+//  This file implements the Parser interfaces.
+//
+//===----------------------------------------------------------------------===//
+
+#include "clang/Parse/Parser.h"
+#include "clang/Basic/Diagnostic.h"
+using namespace llvm;
+using namespace clang;
+
+Parser::Parser(Preprocessor &pp, ParserActions &actions)
+  : PP(pp), Actions(actions), Diags(PP.getDiagnostics()) {}
+
+void Parser::Diag(const LexerToken &Tok, unsigned DiagID,
+                  const std::string &Msg) {
+  Diags.Report(Tok.getLocation(), DiagID, Msg);
+}
+
+
+
+/// ParseTranslationUnit:
+///       translation-unit: [C99 6.9p1]
+///         external-declaration 
+///         translation-unit external-declaration 
+void Parser::ParseTranslationUnit() {
+
+  if (Tok.getKind() == tok::eof)  // Empty source file is an extension.
+    Diag(diag::ext_empty_source_file);
+  
+  while (Tok.getKind() != tok::eof)
+    ParseExternalDeclaration();
+}
+
+/// ParseExternalDeclaration:
+///       external-declaration: [C99 6.9p1]
+///         function-definition        [TODO]
+///         declaration                [TODO]
+/// [EXT]   ';'
+/// [GNU]   asm-definition             [TODO]
+/// [GNU]   __extension__ external-declaration     [TODO]
+/// [OBJC]  objc-class-definition      [TODO]
+/// [OBJC]  objc-class-declaration     [TODO]
+/// [OBJC]  objc-alias-declaration     [TODO]
+/// [OBJC]  objc-protocol-definition   [TODO]
+/// [OBJC]  objc-method-definition     [TODO]
+/// [OBJC]  @end                       [TODO]
+///
+void Parser::ParseExternalDeclaration() {
+  switch (Tok.getKind()) {
+  case tok::semi:
+    Diag(diag::ext_top_level_semi);
+    ConsumeToken();
+    break;
+  default:
+    // We can't tell whether this is a function-definition or declaration yet.
+    ParseDeclarationOrFunctionDefinition();
+    break;
+  }
+}
+
+/// ParseDeclarationOrFunctionDefinition - Parse either a function-definition or
+/// a declaration.  We can't tell which we have until we read the common
+/// declaration-specifiers portion.
+///
+///       function-definition: [C99 6.9.1p1]
+///         declaration-specifiers declarator declaration-list[opt] 
+///                 compound-statement [TODO]
+///       declaration: [C99 6.7p1]
+///         declaration-specifiers init-declarator-list[opt] ';' [TODO]
+/// [OMP]   threadprivate-directive [TODO]
+void Parser::ParseDeclarationOrFunctionDefinition() {
+  ConsumeToken();
+}

Propchange: cfe/cfe/trunk/Parse/Parser.cpp

------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/cfe/trunk/Parse/Parser.cpp

------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: cfe/cfe/trunk/clang.xcodeproj/project.pbxproj
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/clang.xcodeproj/project.pbxproj?rev=38802&r1=38801&r2=38802&view=diff

==============================================================================
--- cfe/cfe/trunk/clang.xcodeproj/project.pbxproj (original)
+++ cfe/cfe/trunk/clang.xcodeproj/project.pbxproj Wed Jul 11 11:24:45 2007
@@ -7,6 +7,10 @@
 	objects = {
 
 /* Begin PBXBuildFile section */
+		DE1F22030A7D852A00FBF588 /* Parser.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE1F22020A7D852A00FBF588 /* Parser.h */; };
+		DE1F22200A7D879000FBF588 /* ParserActions.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DE1F221F0A7D879000FBF588 /* ParserActions.h */; };
+		DE1F22730A7D8D5800FBF588 /* Parser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE1F22710A7D8D5800FBF588 /* Parser.cpp */; };
+		DE1F22740A7D8D5800FBF588 /* ParserActions.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DE1F22720A7D8D5800FBF588 /* ParserActions.cpp */; };
 		DEAEE98B0A5A2B970045101B /* MultipleIncludeOpt.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DEAEE98A0A5A2B970045101B /* MultipleIncludeOpt.h */; };
 		DEAEECAD0A5AF0E30045101B /* clang.h in CopyFiles */ = {isa = PBXBuildFile; fileRef = DEAEECAC0A5AF0E30045101B /* clang.h */; };
 		DEAEECD50A5AF1FE0045101B /* PrintPreprocessedOutput.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DEAEECD40A5AF1FE0045101B /* PrintPreprocessedOutput.cpp */; };
@@ -86,6 +90,8 @@
 				DEAEE98B0A5A2B970045101B /* MultipleIncludeOpt.h in CopyFiles */,
 				DEAEECAD0A5AF0E30045101B /* clang.h in CopyFiles */,
 				DEAEED4B0A5AF89A0045101B /* NOTES.txt in CopyFiles */,
+				DE1F22030A7D852A00FBF588 /* Parser.h in CopyFiles */,
+				DE1F22200A7D879000FBF588 /* ParserActions.h in CopyFiles */,
 			);
 			runOnlyForDeploymentPostprocessing = 1;
 		};
@@ -93,6 +99,10 @@
 
 /* Begin PBXFileReference section */
 		8DD76F6C0486A84900D96B5E /* clang */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = clang; sourceTree = BUILT_PRODUCTS_DIR; };
+		DE1F22020A7D852A00FBF588 /* Parser.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = Parser.h; path = clang/Parse/Parser.h; sourceTree = "<group>"; };
+		DE1F221F0A7D879000FBF588 /* ParserActions.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; name = ParserActions.h; path = clang/Parse/ParserActions.h; sourceTree = "<group>"; };
+		DE1F22710A7D8D5800FBF588 /* Parser.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = Parser.cpp; path = Parse/Parser.cpp; sourceTree = "<group>"; };
+		DE1F22720A7D8D5800FBF588 /* ParserActions.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; name = ParserActions.cpp; path = Parse/ParserActions.cpp; sourceTree = "<group>"; };
 		DEAEE98A0A5A2B970045101B /* MultipleIncludeOpt.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MultipleIncludeOpt.h; sourceTree = "<group>"; };
 		DEAEECAC0A5AF0E30045101B /* clang.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = clang.h; sourceTree = "<group>"; };
 		DEAEECD40A5AF1FE0045101B /* PrintPreprocessedOutput.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = PrintPreprocessedOutput.cpp; sourceTree = "<group>"; };
@@ -158,6 +168,7 @@
 			children = (
 				DED7D7500A5242C7003AD0FB /* Basic */,
 				DED7D78C0A5242E6003AD0FB /* Lex */,
+				DE1F22600A7D8C9B00FBF588 /* Parse */,
 			);
 			name = Source;
 			sourceTree = "<group>";
@@ -179,6 +190,24 @@
 			name = Documentation;
 			sourceTree = "<group>";
 		};
+		DE1F21F20A7D84E800FBF588 /* Parse */ = {
+			isa = PBXGroup;
+			children = (
+				DE1F22020A7D852A00FBF588 /* Parser.h */,
+				DE1F221F0A7D879000FBF588 /* ParserActions.h */,
+			);
+			name = Parse;
+			sourceTree = "<group>";
+		};
+		DE1F22600A7D8C9B00FBF588 /* Parse */ = {
+			isa = PBXGroup;
+			children = (
+				DE1F22710A7D8D5800FBF588 /* Parser.cpp */,
+				DE1F22720A7D8D5800FBF588 /* ParserActions.cpp */,
+			);
+			name = Parse;
+			sourceTree = "<group>";
+		};
 		DEAEECAE0A5AF0FA0045101B /* Driver */ = {
 			isa = PBXGroup;
 			children = (
@@ -194,6 +223,7 @@
 			children = (
 				DED7D7300A524295003AD0FB /* Basic */,
 				DED7D7390A524295003AD0FB /* Lex */,
+				DE1F21F20A7D84E800FBF588 /* Parse */,
 			);
 			path = include;
 			sourceTree = "<group>";
@@ -322,6 +352,8 @@
 				DED7D7C90A5242E6003AD0FB /* Preprocessor.cpp in Sources */,
 				DED7D9E50A5257F6003AD0FB /* ScratchBuffer.cpp in Sources */,
 				DEAEECD50A5AF1FE0045101B /* PrintPreprocessedOutput.cpp in Sources */,
+				DE1F22730A7D8D5800FBF588 /* Parser.cpp in Sources */,
+				DE1F22740A7D8D5800FBF588 /* ParserActions.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};

Modified: cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def?rev=38802&r1=38801&r2=38802&view=diff

==============================================================================
--- cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def (original)
+++ cfe/cfe/trunk/include/clang/Basic/DiagnosticKinds.def Wed Jul 11 11:24:45 2007
@@ -229,4 +229,14 @@
 // Should be a sorry?
 DIAG(err_pp_I_dash_not_supported, ERROR,
      "-I- not supported, please use -iquote instead")
+     
+//===----------------------------------------------------------------------===//
+// Parser Diagnostics
+//===----------------------------------------------------------------------===//
+
+DIAG(ext_empty_source_file, EXTENSION,
+     "ISO C forbids an empty source file")
+DIAG(ext_top_level_semi, EXTENSION,
+     "ISO C does not allow extra ';' outside of a function")
+
 #undef DIAG

Added: cfe/cfe/trunk/include/clang/Parse/Action.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Parse/Action.h?rev=38802&view=auto

==============================================================================
--- cfe/cfe/trunk/include/clang/Parse/Action.h (added)
+++ cfe/cfe/trunk/include/clang/Parse/Action.h Wed Jul 11 11:24:45 2007
@@ -0,0 +1,37 @@
+//===--- ParserActions.h - Parser Actions Interface -------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by Chris Lattner and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+//  This file defines the ParserActions interface.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_PARSE_PARSERACTIONS_H
+#define LLVM_CLANG_PARSE_PARSERACTIONS_H
+
+namespace llvm {
+namespace clang {
+
+/// Parser - This implements a parser for the C family of languages.  After
+/// parsing units of the grammar, productions are invoked to handle whatever has
+/// been read.  The default parser actions are all noops.
+///
+class ParserActions {
+  // SYMBOL TABLE
+public:
+  // Types - Though these don't actually enforce strong typing, they document
+  // what types are required to be identical for the actions.
+  typedef void* ExprTy;
+  
+  
+};
+  
+}  // end namespace clang
+}  // end namespace llvm
+
+#endif

Propchange: cfe/cfe/trunk/include/clang/Parse/Action.h

------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/cfe/trunk/include/clang/Parse/Action.h

------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Added: cfe/cfe/trunk/include/clang/Parse/Parser.h
URL: http://llvm.org/viewvc/llvm-project/cfe/cfe/trunk/include/clang/Parse/Parser.h?rev=38802&view=auto

==============================================================================
--- cfe/cfe/trunk/include/clang/Parse/Parser.h (added)
+++ cfe/cfe/trunk/include/clang/Parse/Parser.h Wed Jul 11 11:24:45 2007
@@ -0,0 +1,76 @@
+//===--- Parser.h - C Language Parser ---------------------------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file was developed by Chris Lattner and is distributed under
+// the University of Illinois Open Source License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+//  This file defines the Parser interface.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_CLANG_PARSE_PARSER_H
+#define LLVM_CLANG_PARSE_PARSER_H
+
+#include "clang/Lex/Preprocessor.h"
+#include "clang/Parse/ParserActions.h"
+
+namespace llvm {
+namespace clang {
+  class ParserActions;
+
+/// Parser - This implements a parser for the C family of languages.  After
+/// parsing units of the grammar, productions are invoked to handle whatever has
+/// been read.
+///
+class Parser {
+  // SYMBOL TABLE
+  Preprocessor &PP;
+  ParserActions &Actions;
+  Diagnostic &Diags;
+  
+  /// Tok - The current token we are peeking head.  All parsing methods assume
+  /// that this is valid.
+  LexerToken Tok;
+public:
+  Parser(Preprocessor &PP, ParserActions &Actions);
+
+  // Type forwarding.  All of these are statically 'void*', but they may all be
+  // different actual classes based on the actions in place.
+  typedef ParserActions::ExprTy ExprTy;
+  
+  // Parsing methods.
+  void ParseTranslationUnit();
+  ExprTy ParseExpression();
+  
+
+  // Diagnostics.
+  void Diag(const LexerToken &Tok, unsigned DiagID, const std::string &Msg="");
+  void Diag(unsigned DiagID, const std::string &Msg="") {
+    Diag(Tok, DiagID, Msg);
+  }
+
+  
+  /// ConsumeToken - Consume the current 'peek token', lexing a new one and
+  /// returning the token kind.
+  tok::TokenKind ConsumeToken() {
+    PP.Lex(Tok);
+    return Tok.getKind();
+  }
+  
+  
+private:
+  //===--------------------------------------------------------------------===//
+
+  // Top level forms.
+  void ParseExternalDeclaration();
+  void ParseDeclarationOrFunctionDefinition();
+    
+};
+
+}  // end namespace clang
+}  // end namespace llvm
+
+#endif

Propchange: cfe/cfe/trunk/include/clang/Parse/Parser.h

------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cfe/cfe/trunk/include/clang/Parse/Parser.h

------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision





More information about the cfe-commits mailing list