CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
83 lines
2.7 KiB
C++
83 lines
2.7 KiB
C++
//===-- ResourceScriptToken.h -----------------------------------*- 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 declares the .rc script tokens and defines an interface for tokenizing
|
|
// the input data. The list of available tokens is located at
|
|
// ResourceScriptTokenList.def.
|
|
//
|
|
// Note that the tokenizer does not support preprocessor directives. The
|
|
// preprocessor should do its work on the .rc file before running llvm-rc.
|
|
//
|
|
// As for now, it is possible to parse ASCII files only (the behavior on
|
|
// UTF files might be undefined). However, it already consumes UTF-8 BOM, if
|
|
// there is any. Thus, ASCII-compatible UTF-8 files are tokenized correctly.
|
|
//
|
|
// Ref: msdn.microsoft.com/en-us/library/windows/desktop/aa380599(v=vs.85).aspx
|
|
//
|
|
//===---------------------------------------------------------------------===//
|
|
|
|
#ifndef LLVM_TOOLS_LLVMRC_RESOURCESCRIPTTOKEN_H
|
|
#define LLVM_TOOLS_LLVMRC_RESOURCESCRIPTTOKEN_H
|
|
|
|
#include "llvm/ADT/StringRef.h"
|
|
#include "llvm/Support/Error.h"
|
|
|
|
#include <cstdint>
|
|
#include <vector>
|
|
|
|
namespace llvm {
|
|
|
|
// A definition of a single resource script token. Each token has its kind
|
|
// (declared in ResourceScriptTokenList) and holds a value - a reference
|
|
// representation of the token.
|
|
// RCToken does not claim ownership on its value. A memory buffer containing
|
|
// the token value should be stored in a safe place and cannot be freed
|
|
// nor reallocated.
|
|
class RCToken {
|
|
public:
|
|
enum class Kind {
|
|
#define TOKEN(Name) Name,
|
|
#define SHORT_TOKEN(Name, Ch) Name,
|
|
#include "ResourceScriptTokenList.def"
|
|
};
|
|
|
|
RCToken(RCToken::Kind RCTokenKind, StringRef Value);
|
|
|
|
// Get an integer value of the integer token.
|
|
uint32_t intValue() const;
|
|
bool isLongInt() const;
|
|
|
|
StringRef value() const;
|
|
Kind kind() const;
|
|
|
|
// Check if a token describes a low precedence binary operator.
|
|
bool isLowPrecedenceBinaryOp() const;
|
|
|
|
// Check if a token describes a high precedence binary operator.
|
|
bool isHighPrecedenceBinaryOp() const;
|
|
|
|
private:
|
|
Kind TokenKind;
|
|
StringRef TokenValue;
|
|
};
|
|
|
|
// Tokenize Input.
|
|
// In case no error occurred, the return value contains
|
|
// tokens in order they were in the input file.
|
|
// In case of any error, the return value contains
|
|
// a textual representation of error.
|
|
//
|
|
// Tokens returned by this function hold only references to the parts
|
|
// of the Input. Memory buffer containing Input cannot be freed,
|
|
// modified or reallocated.
|
|
Expected<std::vector<RCToken>> tokenizeRC(StringRef Input, bool IsWindres);
|
|
|
|
} // namespace llvm
|
|
|
|
#endif
|