private Validation<List<SMFParseError>, SMFSchemaIdentifier> parseStatementIdentifier( final List<String> text) { if (text.length() == 4) { try { final SMFSchemaName schema = SMFSchemaName.of(text.get(1)); final int major = Integer.parseUnsignedInt(text.get(2)); final int minor = Integer.parseUnsignedInt(text.get(3)); return valid(SMFSchemaIdentifier.of(schema, major, minor)); } catch (final NumberFormatException e) { return invalid(List.of(SMFParseError.of( this.reader.position(), e.getMessage(), Optional.of(e)))); } } final StringBuilder sb = new StringBuilder(128); sb.append("Incorrect number of arguments."); sb.append(System.lineSeparator()); sb.append( " Expected: schema <schema> <version-major> <version-minor>"); sb.append(System.lineSeparator()); sb.append(" Received: "); sb.append(text.toJavaStream().collect(Collectors.joining(" "))); sb.append(System.lineSeparator()); return invalid(List.of(SMFParseError.of( this.reader.position(), sb.toString(), Optional.empty()))); }
SMFMetadata.of( SMFSchemaIdentifier.of( SMFSchemaName.of("com.io7m.smf.application"), 1, 0),
schema_name = Optional.empty(); } else { schema_name = Optional.of(SMFSchemaName.of(text.get(0)));
/** * Attempt to parse a command. * * @param file The file, if any * @param line The line * @param text The text * * @return A parsed command or a list of parse errors */ public static Validation<List<SMFParseError>, SMFMemoryMeshFilterType> parse( final Optional<URI> file, final int line, final List<String> text) { NullCheck.notNull(file, "file"); NullCheck.notNull(text, "text"); if (text.length() == 4) { try { final SMFSchemaName name = SMFSchemaName.of(text.get(0)); final int major = Integer.parseUnsignedInt(text.get(1)); final int minor = Integer.parseUnsignedInt(text.get(2)); final Path path = Paths.get(text.get(3)); return valid(create(SMFSchemaIdentifier.of(name, major, minor), path)); } catch (final IllegalArgumentException e) { return errorExpectedGotValidation(file, line, makeSyntax(), text); } } return errorExpectedGotValidation(file, line, makeSyntax(), text); }
final SMFSchemaName schema = SMFSchemaName.of(text.get(0)); final int major = Integer.parseUnsignedInt(text.get(1)); final int minor = Integer.parseUnsignedInt(text.get(2));
final SMFSchemaName schema = SMFSchemaName.of(text.get(0)); final int major = Integer.parseUnsignedInt(text.get(1)); final int minor = Integer.parseUnsignedInt(text.get(2));