stub out a parser hook.

Swift SVN r13
This commit is contained in:
Chris Lattner
2010-07-18 20:17:04 +00:00
parent 3cd9e46705
commit 05f5028b7a
3 changed files with 79 additions and 1 deletions

View File

@@ -25,6 +25,7 @@ namespace llvm {
}
namespace swift {
class Token;
class Lexer {
llvm::SourceMgr &SourceMgr;

View File

@@ -0,0 +1,47 @@
//===--- Parser.h - Swift Language Parser -----------------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This file defines the Parser interface.
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_PARSER_H
#define SWIFT_PARSER_H
namespace llvm {
class SourceMgr;
}
namespace swift {
class Lexer;
class Parser {
llvm::SourceMgr &SourceMgr;
Lexer *L;
Parser(const Parser&); // DO NOT IMPLEMENT
void operator=(const Parser&); // DO NOT IMPLEMENT
public:
Parser(unsigned BufferID, llvm::SourceMgr &SM);
~Parser();
void ParseTranslationUnit();
private:
void Warning(const char *Loc, const char *Message);
void Error(const char *Loc, const char *Message);
};
} // end namespace swift
#endif

View File

@@ -1 +1,31 @@
int x;
//===--- Parser.cpp - Swift Language Parser -------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This file implements the Swift parser.
//
//===----------------------------------------------------------------------===//
#include "swift/Parse/Parser.h"
#include "swift/Parse/Lexer.h"
using namespace swift;
Parser::Parser(unsigned BufferID, llvm::SourceMgr &SM) : SourceMgr(SM) {
L = new Lexer(BufferID, SM);
}
Parser::~Parser() {
delete L;
}
void Parser::ParseTranslationUnit() {
}