Package org.codehaus.jparsec

Examples of org.codehaus.jparsec.DefaultSourceLocator


    addLineBreaks(locator, 3, 5, 7);
    assertEquals(new Location(5, 1), locator.lookup(8));
  }
 
  public void testLookup_secondCharInLastLine() {
    DefaultSourceLocator locator = new DefaultSourceLocator("whatever", 2, 3);
    addLineBreaks(locator, 3, 5, 7);
    assertEquals(new Location(5, 2), locator.lookup(9));
  }
View Full Code Here


    addLineBreaks(locator, 3, 5, 7);
    assertEquals(new Location(5, 2), locator.lookup(9));
  }
 
  public void testScanTo_indexOutOfBounds() {
    DefaultSourceLocator locator = new DefaultSourceLocator("whatever", 2, 3);
    try {
      locator.scanTo(100);
      fail();
    } catch (StringIndexOutOfBoundsException e) {}
  }
View Full Code Here

      fail();
    } catch (StringIndexOutOfBoundsException e) {}
  }
 
  public void testScanTo_indexOnEof() {
    DefaultSourceLocator locator = new DefaultSourceLocator("foo", 2, 3);
    assertEquals(new Location(2, 6), locator.scanTo(3));
    assertEquals(3, locator.nextIndex);
    assertEquals(3, locator.nextColumnIndex);
  }
View Full Code Here

    assertEquals(3, locator.nextIndex);
    assertEquals(3, locator.nextColumnIndex);
  }
 
  public void testScanTo_spansLines() {
    DefaultSourceLocator locator = new DefaultSourceLocator("foo\nbar\n", 2, 3);
    assertEquals(new Location(3, 1), locator.scanTo(4));
    assertEquals(5, locator.nextIndex);
    assertEquals(1, locator.nextColumnIndex);
  }
View Full Code Here

    assertEquals(5, locator.nextIndex);
    assertEquals(1, locator.nextColumnIndex);
  }
 
  public void testScanTo_lastCharOfLine() {
    DefaultSourceLocator locator = new DefaultSourceLocator("foo\nbar\n", 2, 3);
    assertEquals(new Location(3, 4), locator.scanTo(7));
    assertEquals(8, locator.nextIndex);
    assertEquals(0, locator.nextColumnIndex);
  }
View Full Code Here

    assertEquals(8, locator.nextIndex);
    assertEquals(0, locator.nextColumnIndex);
  }
 
  public void testLocate() {
    DefaultSourceLocator locator = new DefaultSourceLocator("foo\nbar\n", 2, 3);
    assertEquals(new Location(3, 4), locator.locate(7));
    assertEquals(new Location(2, 5), locator.locate(2)); // this will call lookup()
  }
View Full Code Here

TOP

Related Classes of org.codehaus.jparsec.DefaultSourceLocator

Copyright © 2018 www.massapicom. 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.