public SMDefinition Condense() { Token ct; while ((ct = t[position]).Kind != TokenKind.EOF) { if (ct.Kind == TokenKind.FunctionIndicator) { int newIndex = ConsumeSMFunction(); if (newIndex != -1) { position = newIndex + 1; continue; } } if (ct.Kind == TokenKind.Enum) { int newIndex = ConsumeSMEnum(); if (newIndex != -1) { position = newIndex + 1; continue; } } if (ct.Kind == TokenKind.PrePocessorDirective) { int newIndex = ConsumeSMPPDirective(); if (newIndex != -1) { position = newIndex + 1; continue; } } if (ct.Kind == TokenKind.Constant) { int newIndex = ConsumeSMConstant(); if (newIndex != -1) { position = newIndex + 1; continue; } } ++position; } def.Sort(); return(def); }
public SMDefinition Condense() { Token ct = null; while ((ct = t[position]).Kind != TokenKind.EOF) { switch (ct.Kind) { case TokenKind.FunctionIndicator: { var newIndex = ConsumeSMFunction(); if (newIndex != -1) { position = newIndex + 1; continue; } break; } case TokenKind.EnumStruct: { var newIndex = ConsumeSMEnumStruct(); if (newIndex != -1) { position = newIndex + 1; continue; } break; } case TokenKind.Enum: { var newIndex = ConsumeSMEnum(); if (newIndex != -1) { position = newIndex + 1; continue; } break; } case TokenKind.Struct: { var newIndex = ConsumeSMStruct(); if (newIndex != -1) { position = newIndex + 1; continue; } break; } case TokenKind.PrePocessorDirective: { var newIndex = ConsumeSMPPDirective(); if (newIndex != -1) { position = newIndex + 1; continue; } break; } case TokenKind.Constant: { var newIndex = ConsumeSMConstant(); if (newIndex != -1) { position = newIndex + 1; continue; } break; } case TokenKind.MethodMap: { var newIndex = ConsumeSMMethodmap(); if (newIndex != -1) { position = newIndex + 1; continue; } break; } case TokenKind.TypeSet: { var newIndex = ConsumeSMTypeset(); if (newIndex != -1) { position = newIndex + 1; continue; } break; } case TokenKind.TypeDef: { var newIndex = ConsumeSMTypedef(); if (newIndex != -1) { position = newIndex + 1; continue; } break; } case TokenKind.Identifier: { var newIndex = ConsumeSMVariable(); if (newIndex != -1) { position = newIndex + 1; continue; } // If Variable is not found try function newIndex = ConsumeSMFunction(); if (newIndex != -1) { position = newIndex + 1; continue; } } break; } ++position; } def.Sort(); return(def); }
public SMDefinition Condense() { Token ct = null; while ((ct = t[position]).Kind != TokenKind.EOF) { if (ct.Kind == TokenKind.FunctionIndicator) { int newIndex = ConsumeSMFunction(); if (newIndex != -1) { position = newIndex + 1; continue; } } if (ct.Kind == TokenKind.Enum) { int newIndex = ConsumeSMEnum(); if (newIndex != -1) { position = newIndex + 1; continue; } } if (ct.Kind == TokenKind.Struct) { int newIndex = ConsumeSMStruct(); if (newIndex != -1) { position = newIndex + 1; continue; } } if (ct.Kind == TokenKind.PrePocessorDirective) { int newIndex = ConsumeSMPPDirective(); if (newIndex != -1) { position = newIndex + 1; continue; } } if (ct.Kind == TokenKind.Constant) { int newIndex = ConsumeSMConstant(); if (newIndex != -1) { position = newIndex + 1; continue; } } if (ct.Kind == TokenKind.MethodMap) { int newIndex = ConsumeSMMethodmap(); if (newIndex != -1) { position = newIndex + 1; continue; } } if (ct.Kind == TokenKind.TypeSet) { int newIndex = ConsumeSMTypeset(); if (newIndex != -1) { position = newIndex + 1; continue; } } if (ct.Kind == TokenKind.TypeDef) { int newIndex = ConsumeSMTypedef(); if (newIndex != -1) { position = newIndex + 1; continue; } } ++position; } def.Sort(); return(def); }