} else { msg = new DynamicMessage(); fields.put(key, Value.createMessage(sourceCodeLocation, msg));
} else { msg = new DynamicMessage(); fields.put(key, Value.createMessage(sourceCodeLocation, msg));
SourceCodeLocation sourceCodeLocation = getSourceCodeLocation(optionValueContext); if (optionValueContext.textFormat() != null) { optionValue = DynamicMessage.Value.createMessage(sourceCodeLocation, lastTextFormat); } else if (optionValueContext.BOOLEAN_VALUE() != null) { String text = optionValueContext.BOOLEAN_VALUE().getText();
SourceCodeLocation sourceCodeLocation = getSourceCodeLocation(optionValueContext); if (optionValueContext.textFormat() != null) { optionValue = DynamicMessage.Value.createMessage(sourceCodeLocation, lastTextFormat); } else if (optionValueContext.BOOLEAN_VALUE() != null) { String text = optionValueContext.BOOLEAN_VALUE().getText();
private DynamicMessage.Value getTextFormatOptionValue(ProtoParser.TextFormatEntryContext ctx) { DynamicMessage.Value optionValue; SourceCodeLocation sourceCodeLocation = getSourceCodeLocation(ctx); if (ctx.textFormat() != null) { optionValue = DynamicMessage.Value.createMessage(sourceCodeLocation, lastTextFormat); } else if (ctx.textFormatOptionValue().BOOLEAN_VALUE() != null) { String text = ctx.textFormatOptionValue().BOOLEAN_VALUE().getText(); boolean value = Boolean.parseBoolean(text); optionValue = DynamicMessage.Value.createBoolean(sourceCodeLocation, value); } else if (ctx.textFormatOptionValue().INTEGER_VALUE() != null) { String text = ctx.textFormatOptionValue().INTEGER_VALUE().getText(); optionValue = parseInteger(sourceCodeLocation, text); } else if (ctx.textFormatOptionValue().STRING_VALUE() != null) { String text = ctx.textFormatOptionValue().STRING_VALUE().getText(); // TODO: unescape optionValue = DynamicMessage.Value.createString(sourceCodeLocation, Util.removeFirstAndLastChar(text)); } else if (ctx.textFormatOptionValue().IDENT() != null) { String text = ctx.textFormatOptionValue().IDENT().getText(); optionValue = DynamicMessage.Value.createEnum(sourceCodeLocation, text); } else if (ctx.textFormatOptionValue().FLOAT_VALUE() != null) { String text = ctx.textFormatOptionValue().FLOAT_VALUE().getText(); double value = Double.parseDouble(text); optionValue = DynamicMessage.Value.createFloat(sourceCodeLocation, value); } else { throw new IllegalStateException(); } return optionValue; }
private DynamicMessage.Value getTextFormatOptionValue(ProtoParser.TextFormatEntryContext ctx) { DynamicMessage.Value optionValue; SourceCodeLocation sourceCodeLocation = getSourceCodeLocation(ctx); if (ctx.textFormat() != null) { optionValue = DynamicMessage.Value.createMessage(sourceCodeLocation, lastTextFormat); } else if (ctx.textFormatOptionValue().BOOLEAN_VALUE() != null) { String text = ctx.textFormatOptionValue().BOOLEAN_VALUE().getText(); boolean value = Boolean.parseBoolean(text); optionValue = DynamicMessage.Value.createBoolean(sourceCodeLocation, value); } else if (ctx.textFormatOptionValue().INTEGER_VALUE() != null) { String text = ctx.textFormatOptionValue().INTEGER_VALUE().getText(); optionValue = parseInteger(sourceCodeLocation, text); } else if (ctx.textFormatOptionValue().STRING_VALUE() != null) { String text = ctx.textFormatOptionValue().STRING_VALUE().getText(); // TODO: unescape optionValue = DynamicMessage.Value.createString(sourceCodeLocation, Util.removeFirstAndLastChar(text)); } else if (ctx.textFormatOptionValue().IDENT() != null) { String text = ctx.textFormatOptionValue().IDENT().getText(); optionValue = DynamicMessage.Value.createEnum(sourceCodeLocation, text); } else if (ctx.textFormatOptionValue().FLOAT_VALUE() != null) { String text = ctx.textFormatOptionValue().FLOAT_VALUE().getText(); double value = Double.parseDouble(text); optionValue = DynamicMessage.Value.createFloat(sourceCodeLocation, value); } else { throw new IllegalStateException(); } return optionValue; }