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()))); }
NullCheck.notNull(text, "text"); if (text.length() > 0 && text.length() <= 3) { try { final Optional<SMFSchemaName> schema_name; schema_name = Optional.of(SMFSchemaName.of(text.get(0))); if (text.length() == 2) { schema_version = Optional.empty(); if (text.length() == 3) { final int major = Integer.parseUnsignedInt(text.get(1)); final int minor = Integer.parseUnsignedInt(text.get(2));
final List<String> line) if (line.length() == 6) { final String text_req = line.get(1); final String text_name = line.get(2);
private void parseMeta( final List<String> line) throws Exception { if (line.length() == 4) { final long vendor_id = (long) Integer.parseUnsignedInt(line.get(1), 16); final long schema_id = (long) Integer.parseUnsignedInt(line.get(2), 16); final long lines = Long.parseUnsignedLong(line.get(3)); this.parseMetaDataValues(vendor_id, schema_id, lines); } else { super.failExpectedGot( "Incorrect number of arguments", "meta <vendor-id> <schema-id> <integer-unsigned>", line.toJavaStream().collect(Collectors.joining(" "))); } }
if (line.length() == 3) { try { final long v0 = Long.parseUnsignedLong(line.get(0));
NullCheck.notNull(text, "text"); if (text.length() == 4) { try { final SMFAttributeName attr = SMFAttributeName.of(text.get(0));
if (line.length() != 3) { return invalid(List.of(this.makeErrorExpectedGot( "Incorrect number of arguments.",
NullCheck.notNull(text, "text"); if (text.length() == 2) { try { final int size;
/** * 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() == 1) { try { return valid(create(Paths.get(text.get(0)))); } catch (final IllegalArgumentException e) { return errorExpectedGotValidation(file, line, makeSyntax(), text); } } return errorExpectedGotValidation(file, line, makeSyntax(), text); }
/** * 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() >= 1) { try { return valid(create(text.map(SMFAttributeName::of).toSet())); } catch (final IllegalArgumentException e) { return errorExpectedGotValidation(file, line, makeSyntax(), text); } } return errorExpectedGotValidation(file, line, makeSyntax(), text); }
/** * 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() == 1) { try { final SMFAttributeName attr = SMFAttributeName.of(text.get(0)); return Validation.valid(create(attr)); } catch (final IllegalArgumentException e) { return errorExpectedGotValidation(file, line, makeSyntax(), text); } } return errorExpectedGotValidation(file, line, makeSyntax(), text); }
/** * 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() == 2) { try { final SMFAttributeName name = SMFAttributeName.of(text.get(0)); final int size = Integer.parseUnsignedInt(text.get(1)); return valid(create(name, size)); } catch (final IllegalArgumentException e) { return errorExpectedGotValidation(file, line, makeSyntax(), text); } } return errorExpectedGotValidation(file, line, makeSyntax(), text); }
/** * 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); }
/** * 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() == 2) { try { final SMFAttributeName source = SMFAttributeName.of(text.get(0)); final SMFAttributeName target = SMFAttributeName.of(text.get(1)); return Validation.valid( create(source, target)); } catch (final IllegalArgumentException e) { return errorExpectedGotValidation(file, line, makeSyntax(), text); } } return errorExpectedGotValidation(file, line, makeSyntax(), text); }
NullCheck.notNull(text, "text"); if (text.length() == 3) { try { final SMFSchemaName schema = SMFSchemaName.of(text.get(0));
NullCheck.notNull(text, "text"); if (text.length() == 3) { try { final SMFSchemaName schema = SMFSchemaName.of(text.get(0));