llvm/mlir/tools/mlir-tblgen/FormatGen.cpp

//===- FormatGen.cpp - Utilities for custom assembly formats ----*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#include "FormatGen.h"
#include "llvm/ADT/StringSwitch.h"
#include "llvm/Support/SourceMgr.h"
#include "llvm/TableGen/Error.h"

usingnamespacemlir;
usingnamespacemlir::tblgen;

//===----------------------------------------------------------------------===//
// FormatToken
//===----------------------------------------------------------------------===//

SMLoc FormatToken::getLoc() const {}

//===----------------------------------------------------------------------===//
// FormatLexer
//===----------------------------------------------------------------------===//

FormatLexer::FormatLexer(llvm::SourceMgr &mgr, SMLoc loc)
    :{}

FormatToken FormatLexer::emitError(SMLoc loc, const Twine &msg) {}

FormatToken FormatLexer::emitError(const char *loc, const Twine &msg) {}

FormatToken FormatLexer::emitErrorAndNote(SMLoc loc, const Twine &msg,
                                          const Twine &note) {}

int FormatLexer::getNextChar() {}

FormatToken FormatLexer::lexToken() {}

FormatToken FormatLexer::lexLiteral(const char *tokStart) {}

FormatToken FormatLexer::lexVariable(const char *tokStart) {}

FormatToken FormatLexer::lexString(const char *tokStart) {}

FormatToken FormatLexer::lexIdentifier(const char *tokStart) {}

//===----------------------------------------------------------------------===//
// FormatParser
//===----------------------------------------------------------------------===//

FormatElement::~FormatElement() = default;

FormatParser::~FormatParser() = default;

FailureOr<std::vector<FormatElement *>> FormatParser::parse() {}

//===----------------------------------------------------------------------===//
// Element Parsing

FailureOr<FormatElement *> FormatParser::parseElement(Context ctx) {}

FailureOr<FormatElement *> FormatParser::parseLiteral(Context ctx) {}

FailureOr<FormatElement *> FormatParser::parseString(Context ctx) {}

FailureOr<FormatElement *> FormatParser::parseVariable(Context ctx) {}

FailureOr<FormatElement *> FormatParser::parseDirective(Context ctx) {}

FailureOr<FormatElement *> FormatParser::parseOptionalGroup(Context ctx) {}

FailureOr<FormatElement *> FormatParser::parseCustomDirective(SMLoc loc,
                                                              Context ctx) {}

FailureOr<FormatElement *> FormatParser::parseRefDirective(SMLoc loc,
                                                           Context context) {}

FailureOr<FormatElement *> FormatParser::parseQualifiedDirective(SMLoc loc,
                                                                 Context ctx) {}

//===----------------------------------------------------------------------===//
// Utility Functions
//===----------------------------------------------------------------------===//

bool mlir::tblgen::shouldEmitSpaceBefore(StringRef value,
                                         bool lastWasPunctuation) {}

bool mlir::tblgen::canFormatStringAsKeyword(
    StringRef value, function_ref<void(Twine)> emitError) {}

bool mlir::tblgen::isValidLiteral(StringRef value,
                                  function_ref<void(Twine)> emitError) {}

//===----------------------------------------------------------------------===//
// Commandline Options
//===----------------------------------------------------------------------===//

llvm::cl::opt<bool> mlir::tblgen::formatErrorIsFatal(
    "asmformat-error-is-fatal",
    llvm::cl::desc("Emit a fatal error if format parsing fails"),
    llvm::cl::init(true));