llvm/llvm/tools/llvm-rc/ResourceScriptParser.cpp

//===-- ResourceScriptParser.cpp --------------------------------*- 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
//
//===---------------------------------------------------------------------===//
//
// This implements the parser defined in ResourceScriptParser.h.
//
//===---------------------------------------------------------------------===//

#include "ResourceScriptParser.h"
#include "llvm/ADT/StringExtras.h"
#include "llvm/Option/ArgList.h"
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Path.h"
#include "llvm/Support/Process.h"

// Take an expression returning llvm::Error and forward the error if it exists.
#define RETURN_IF_ERROR(Expr)

// Take an expression returning llvm::Expected<T> and assign it to Var or
// forward the error out of the function.
#define ASSIGN_OR_RETURN(Var, Expr)

namespace llvm {
namespace rc {

RCParser::ParserError::ParserError(const Twine &Expected, const LocIter CurLoc,
                                   const LocIter End)
    :{}

char RCParser::ParserError::ID =;

RCParser::RCParser(std::vector<RCToken> TokenList)
    :{}

bool RCParser::isEof() const {}

RCParser::ParseType RCParser::parseSingleResource() {}

bool RCParser::isNextTokenKind(Kind TokenKind) const {}

const RCToken &RCParser::look() const {}

const RCToken &RCParser::read() {}

void RCParser::consume() {}

// An integer description might consist of a single integer or
// an arithmetic expression evaluating to the integer. The expressions
// can contain the following tokens: <int> ( ) + - | & ~ not. Their meaning
// is the same as in C++ except for 'not' expression.
// The operators in the original RC implementation have the following
// precedence:
//   1) Unary operators (- ~ not),
//   2) Binary operators (+ - & |), with no precedence.
//
// 'not' expression is mostly useful for style values. It evaluates to 0,
// but value given to the operator is stored separately from integer value.
// It's mostly useful for control style expressions and causes bits from
// default control style to be excluded from generated style. For binary
// operators the mask from the right operand is applied to the left operand
// and masks from both operands are combined in operator result.
//
// The following grammar is used to parse the expressions Exp1:
//   Exp1 ::= Exp2 || Exp1 + Exp2 || Exp1 - Exp2 || Exp1 | Exp2 || Exp1 & Exp2
//   Exp2 ::= -Exp2 || ~Exp2 || not Expr2 || Int || (Exp1).
// (More conveniently, Exp1 is a non-empty sequence of Exp2 expressions,
// separated by binary operators.)
//
// Expressions of type Exp1 are read by parseIntExpr1(Inner) method, while Exp2
// is read by parseIntExpr2().
//
// The original Microsoft tool handles multiple unary operators incorrectly.
// For example, in 16-bit little-endian integers:
//    1 => 01 00, -1 => ff ff, --1 => ff ff, ---1 => 01 00;
//    1 => 01 00, ~1 => fe ff, ~~1 => fd ff, ~~~1 => fc ff.
// Our implementation differs from the original one and handles these
// operators correctly:
//    1 => 01 00, -1 => ff ff, --1 => 01 00, ---1 => ff ff;
//    1 => 01 00, ~1 => fe ff, ~~1 => 01 00, ~~~1 => fe ff.

Expected<RCInt> RCParser::readInt() {}

Expected<IntWithNotMask> RCParser::parseIntExpr1() {}

Expected<IntWithNotMask> RCParser::parseIntExpr2() {}

Expected<StringRef> RCParser::readString() {}

Expected<StringRef> RCParser::readFilename() {}

Expected<StringRef> RCParser::readIdentifier() {}

Expected<IntOrString> RCParser::readIntOrString() {}

Expected<IntOrString> RCParser::readTypeOrName() {}

Error RCParser::consumeType(Kind TokenKind) {}

bool RCParser::consumeOptionalType(Kind TokenKind) {}

Expected<SmallVector<RCInt, 8>> RCParser::readIntsWithCommas(size_t MinCount,
                                                             size_t MaxCount) {}

Expected<uint32_t> RCParser::parseFlags(ArrayRef<StringRef> FlagDesc,
                                        ArrayRef<uint32_t> FlagValues) {}

uint16_t RCParser::parseMemoryFlags(uint16_t Flags) {}

Expected<OptionalStmtList>
RCParser::parseOptionalStatements(OptStmtType StmtsType) {}

Expected<std::unique_ptr<OptionalStmt>>
RCParser::parseSingleOptionalStatement(OptStmtType StmtsType) {}

RCParser::ParseType RCParser::parseLanguageResource() {}

RCParser::ParseType RCParser::parseAcceleratorsResource() {}

RCParser::ParseType RCParser::parseCursorResource() {}

RCParser::ParseType RCParser::parseDialogResource(bool IsExtended) {}

RCParser::ParseType RCParser::parseUserDefinedResource(IntOrString Type) {}

RCParser::ParseType RCParser::parseVersionInfoResource() {}

Expected<Control> RCParser::parseControl() {}

RCParser::ParseType RCParser::parseBitmapResource() {}

RCParser::ParseType RCParser::parseIconResource() {}

RCParser::ParseType RCParser::parseHTMLResource() {}

RCParser::ParseType RCParser::parseMenuResource() {}

RCParser::ParseType RCParser::parseMenuExResource() {}

Expected<MenuDefinitionList> RCParser::parseMenuItemsList() {}

Expected<MenuDefinitionList> RCParser::parseMenuExItemsList() {}

RCParser::ParseType RCParser::parseStringTableResource() {}

Expected<std::unique_ptr<VersionInfoBlock>>
RCParser::parseVersionInfoBlockContents(StringRef BlockName) {}

Expected<std::unique_ptr<VersionInfoStmt>> RCParser::parseVersionInfoStmt() {}

Expected<VersionInfoResource::VersionInfoFixed>
RCParser::parseVersionInfoFixed() {}

RCParser::ParseOptionType RCParser::parseLanguageStmt() {}

RCParser::ParseOptionType RCParser::parseCharacteristicsStmt() {}

RCParser::ParseOptionType RCParser::parseVersionStmt() {}

RCParser::ParseOptionType RCParser::parseCaptionStmt() {}

RCParser::ParseOptionType RCParser::parseClassStmt() {}

RCParser::ParseOptionType RCParser::parseFontStmt(OptStmtType DialogType) {}

RCParser::ParseOptionType RCParser::parseStyleStmt() {}

RCParser::ParseOptionType RCParser::parseExStyleStmt() {}

RCParser::ParseOptionType RCParser::parseMenuStmt() {}

Error RCParser::getExpectedError(const Twine &Message, bool IsAlreadyRead) {}

} // namespace rc
} // namespace llvm