Skip to content
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.
This repository has been archived by the owner on Feb 20, 2024. It is now read-only.

Enum variables become empty #13

Open
@mingodad

Description

Hello !
Testing the C++ generated by skew I noticed that the generated enums are all empty, adding some debugging to console I can see that at parse time the enum variables has content but at emit time the variables content is empty, I'm still trying to find why this happen.

Cheers !

    switch (symbol.kind) {
      case Skew.SymbolKind.OBJECT_ENUM:
      case Skew.SymbolKind.OBJECT_FLAGS: {
        this._adjustNamespace(symbol);
        this._emitNewlineBeforeSymbol(symbol, Skew.CPlusPlusEmitter.CodeMode.DECLARE);

///////////////////////////// to debug variables empty 
    this._emit(this._indent + '// ' + symbol.name + ' : ' + symbol.variables.length + '\n');
///////////////////////////// to debug variables empty 
        if (symbol.kind == Skew.SymbolKind.OBJECT_FLAGS) {
          this._emit(this._indent + 'namespace ' + Skew.CPlusPlusEmitter._mangleName(symbol) + ' {\n');
          this._increaseIndent();

          if (!(symbol.variables.length == 0)) {
            this._emit(this._indent + 'enum {\n');
          }
        }
Enum: PassKind : EMITTING : 1

Enum: EmitMode : ALWAYS_EMIT : 1

Enum: EmitMode : SKIP_IF_EMPTY : 2

Enum: QuoteStyle : DOUBLE : 1

Enum: QuoteStyle : SINGLE : 2

Enum: QuoteStyle : SHORTEST : 3

Enum: QuoteOctal : NORMAL : 1

Enum: QuoteOctal : OCTAL_WORKAROUND : 2

Enum: Associativity : NONE : 1

Enum: Associativity : LEFT : 2

Enum: Associativity : RIGHT : 3

Enum: CodeMode : DECLARE : 1

Enum: CodeMode : DEFINE : 2

Enum: CodeMode : IMPLEMENT : 3

Enum: CppEmitMode : BARE : 1

Enum: CppEmitMode : NORMAL : 2

Enum: CppEmitMode : DECLARATION : 3

Enum: OperatorKind : FIXED : 1

Enum: OperatorKind : OVERRIDABLE : 2
    // Special-case enum and flags symbols
    if (Skew.in_SymbolKind.isEnumOrFlags(parent.kind) && tokenKind == Skew.TokenKind.IDENTIFIER && kind == Skew.SymbolKind.OBJECT_GLOBAL) {
      while (true) {
        if (text in Skew.Parsing.identifierToSymbolKind || !context.expect(Skew.TokenKind.IDENTIFIER)) {
          break;
        }

        var variable = new Skew.VariableSymbol(Skew.SymbolKind.VARIABLE_ENUM_OR_FLAGS, text);
        variable.range = token.range;
        variable.parent = parent;
        variable.flags |= Skew.SymbolFlags.IS_CONST;
        parent.variables.push(variable);
///////////////////////////// to debug variables empty 
    process.stdout.write('\nEnum: ' + parent.name + ' : ' + text + ' : ' + parent.variables.length + '\n');
///////////////////////////// to debug variables empty 
        symbol = variable;
        var comma = context.current();

        if (!context.eat(Skew.TokenKind.COMMA)) {
          break;
        }
namespace Skew {
  struct SourceMapping;
  struct SourceMapGenerator;

  // PassKind : 0
  enum struct PassKind {
  };

  // EmitMode : 0
  enum struct EmitMode {
  };

  struct Emitter;
  struct JavaScriptEmitter;

  // QuoteStyle : 0
  enum struct QuoteStyle {
  };

  // QuoteOctal : 0
  enum struct QuoteOctal {
  };

  // Associativity : 0
  enum struct Associativity {
  };

  // Precedence : 0
  enum struct Precedence {
  };

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions