Examples of VariableAssignmentParser


Examples of org.apache.wicket.util.parse.metapattern.parsers.VariableAssignmentParser

    {
      // Get the next key value pair
      final String pair = iterator.next();

      // Parse using metapattern parser for variable assignments
      final VariableAssignmentParser parser = new VariableAssignmentParser(pair, valuePattern);

      // Does it parse?
      if (parser.matches())
      {
        // Succeeded. Put key and value into map
        put(parser.getKey(), parser.getValue());
      }
      else
      {
        throw new IllegalArgumentException("Invalid key value list: '" + keyValuePairs +
          '\'');
View Full Code Here

Examples of org.apache.wicket.util.parse.metapattern.parsers.VariableAssignmentParser

      {
        return true;
      }

      // Extract attributes
      final VariableAssignmentParser attributeParser = new VariableAssignmentParser(tagText);
      while (attributeParser.matcher().find(pos))
      {
        // Get key and value using attribute pattern
        String value = attributeParser.getValue();

        // In case like <html xmlns:wicket> will the value be null
        if (value == null)
        {
          value = "";
        }

        // Set new position to end of attribute
        pos = attributeParser.matcher().end(0);

        // Chop off double quotes or single quotes
        if (value.startsWith("\"") || value.startsWith("\'"))
        {
          value = value.substring(1, value.length() - 1);
        }

        // Trim trailing whitespace
        value = value.trim();

        // Unescape
        value = Strings.unescapeMarkup(value).toString();

        // Get key
        final String key = attributeParser.getKey();

        // Put the attribute in the attributes hash
        if (null != tag.getAttributes().put(key, value))
        {
          throw new ParseException("Same attribute found twice: " + key +
View Full Code Here

Examples of org.apache.wicket.util.parse.metapattern.parsers.VariableAssignmentParser

      {
        return true;
      }

      // Extract attributes
      final VariableAssignmentParser attributeParser = new VariableAssignmentParser(tagText);
      while (attributeParser.matcher().find(pos))
      {
        // Get key and value using attribute pattern
        String value = attributeParser.getValue();

        // In case like <html xmlns:wicket> will the value be null
        if (value == null)
        {
          value = "";
        }

        // Set new position to end of attribute
        pos = attributeParser.matcher().end(0);

        // Chop off double quotes or single quotes
        if (value.startsWith("\"") || value.startsWith("\'"))
        {
          value = value.substring(1, value.length() - 1);
        }

        // Trim trailing whitespace
        value = value.trim();

        // Get key
        final String key = attributeParser.getKey();

        // Put the attribute in the attributes hash
        if (null != tag.getAttributes().put(key, value))
        {
          throw new ParseException("Same attribute found twice: " + key +
View Full Code Here

Examples of org.apache.wicket.util.parse.metapattern.parsers.VariableAssignmentParser

      {
        return true;
      }

      // Extract attributes
      final VariableAssignmentParser attributeParser = new VariableAssignmentParser(tagText);
      while (attributeParser.matcher().find(pos))
      {
        // Get key and value using attribute pattern
        String value = attributeParser.getValue();

        // In case like <html xmlns:wicket> will the value be null
        if (value == null)
        {
          value = "";
        }

        // Set new position to end of attribute
        pos = attributeParser.matcher().end(0);

        // Chop off double quotes or single quotes
        if (value.startsWith("\"") || value.startsWith("\'"))
        {
          value = value.substring(1, value.length() - 1);
        }

        // Trim trailing whitespace
        value = value.trim();

        // Unescape
        value = Strings.unescapeMarkup(value).toString();

        // Get key
        final String key = attributeParser.getKey();

        // Put the attribute in the attributes hash
        if (null != tag.getAttributes().put(key, value))
        {
          throw new ParseException("Same attribute found twice: " + key +
View Full Code Here

Examples of org.apache.wicket.util.parse.metapattern.parsers.VariableAssignmentParser

  /**
   * Test assignment of variables.
   */
  public void testVariableAssignmentParser()
  {
    VariableAssignmentParser parser = new VariableAssignmentParser("foo = 9");
    assertTrue(parser.matches());
    assertEquals("foo", parser.getKey());
    assertEquals("9", parser.getValue());

    parser = new VariableAssignmentParser("foo=9");
    assertTrue(parser.matches());
    assertEquals("foo", parser.getKey());
    assertEquals("9", parser.getValue());
  }
View Full Code Here

Examples of org.apache.wicket.util.parse.metapattern.parsers.VariableAssignmentParser

      {
        return true;
      }

      // Extract attributes
      final VariableAssignmentParser attributeParser = new VariableAssignmentParser(tagText);
      while (attributeParser.matcher().find(pos))
      {
        // Get key and value using attribute pattern
        String value = attributeParser.getValue();

        // In case like <html xmlns:wicket> will the value be null
        if (value == null)
        {
          value = "";
        }

        // Set new position to end of attribute
        pos = attributeParser.matcher().end(0);

        // Chop off double quotes or single quotes
        if (value.startsWith("\"") || value.startsWith("\'"))
        {
          value = value.substring(1, value.length() - 1);
        }

        // Trim trailing whitespace
        value = value.trim();

        // Get key
        final String key = attributeParser.getKey();

        // Put the attribute in the attributes hash
        if (null != ((TagAttributes)tag.getAttributes()).putInternal(key, value))
        {
          throw new ParseException("Same attribute found twice: " + key +
View Full Code Here

Examples of org.apache.wicket.util.parse.metapattern.parsers.VariableAssignmentParser

    {
      // Get the next key value pair
      final String pair = iterator.next();

      // Parse using metapattern parser for variable assignments
      final VariableAssignmentParser parser = new VariableAssignmentParser(pair, valuePattern);

      // Does it parse?
      if (parser.matches())
      {
        // Succeeded. Put key and value into map
        put(parser.getKey(), parser.getValue());
      }
      else
      {
        throw new IllegalArgumentException("Invalid key value list: '" + keyValuePairs +
          '\'');
View Full Code Here

Examples of org.apache.wicket.util.parse.metapattern.parsers.VariableAssignmentParser

    {
      // Get the next key value pair
      final String pair = iterator.next();

      // Parse using metapattern parser for variable assignments
      final VariableAssignmentParser parser = new VariableAssignmentParser(pair, valuePattern);

      // Does it parse?
      if (parser.matches())
      {
        // Succeeded. Put key and value into map
        put(parser.getKey(), parser.getValue());
      }
      else
      {
        throw new IllegalArgumentException("Invalid key value list: '" + keyValuePairs +
          '\'');
View Full Code Here

Examples of org.apache.wicket.util.parse.metapattern.parsers.VariableAssignmentParser

    {
      // Get the next key value pair
      final String pair = iterator.next();

      // Parse using metapattern parser for variable assignments
      final VariableAssignmentParser parser = new VariableAssignmentParser(pair, valuePattern);

      // Does it parse?
      if (parser.matches())
      {
        // Succeeded. Put key and value into map
        put(parser.getKey(), parser.getValue());
      }
      else
      {
        throw new IllegalArgumentException("Invalid key value list: '" + keyValuePairs +
          '\'');
View Full Code Here

Examples of org.apache.wicket.util.parse.metapattern.parsers.VariableAssignmentParser

      {
        return true;
      }

      // Extract attributes
      final VariableAssignmentParser attributeParser = new VariableAssignmentParser(tagText);
      while (attributeParser.matcher().find(pos))
      {
        // Get key and value using attribute pattern
        String value = attributeParser.getValue();

        // In case like <html xmlns:wicket> will the value be null
        if (value == null)
        {
          value = "";
        }

        // Set new position to end of attribute
        pos = attributeParser.matcher().end(0);

        // Chop off double quotes or single quotes
        if (value.startsWith("\"") || value.startsWith("\'"))
        {
          value = value.substring(1, value.length() - 1);
        }

        // Trim trailing whitespace
        value = value.trim();

        // Get key
        final String key = attributeParser.getKey();

        // Put the attribute in the attributes hash
        if (null != tag.getAttributes().put(key, value))
        {
          throw new ParseException("Same attribute found twice: " + key +
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.