Package net.sf.jabref.bst

Examples of net.sf.jabref.bst.VM.run()


    {
      VM vm = new VM("FUNCTION {test} { \"Johnny Foo and Mary Bar\" num.names$ }"
        + "EXECUTE {test}");

      Vector<BibtexEntry> v = new Vector<BibtexEntry>();
      vm.run(v);
      assertEquals(new Integer(2), vm.getStack().pop());
      assertEquals(0, vm.getStack().size());
    }
    {
      VM vm = new VM("FUNCTION {test} { \"Johnny Foo { and } Mary Bar\" num.names$ }"
View Full Code Here


    {
      VM vm = new VM("FUNCTION {test} { \"Johnny Foo { and } Mary Bar\" num.names$ }"
        + "EXECUTE {test}");

      Vector<BibtexEntry> v = new Vector<BibtexEntry>();
      vm.run(v);
      assertEquals(new Integer(1), vm.getStack().pop());
      assertEquals(0, vm.getStack().size());
    }
  }
View Full Code Here

          + "\"Johnny!\" add.period$ \"Johnny?\" add.period$ \"Johnny} }}}\" add.period$"
          + "\"Johnny!}\" add.period$ \"Johnny?}\" add.period$ \"Johnny.}\" add.period$ }"
          + "EXECUTE {test}");

      Vector<BibtexEntry> v = new Vector<BibtexEntry>();
      vm.run(v);
      assertEquals("Johnny.}", vm.getStack().pop());
      assertEquals("Johnny?}", vm.getStack().pop());
      assertEquals("Johnny!}", vm.getStack().pop());
      assertEquals("Johnny.}", vm.getStack().pop());
      assertEquals("Johnny?", vm.getStack().pop());
View Full Code Here

      "  \"123456789\" #-2 #2  substring$ " + // 78

      "} EXECUTE {test} ");

    Vector<BibtexEntry> v = new Vector<BibtexEntry>();
    vm.run(v);
    assertEquals("78", vm.getStack().pop());
    assertEquals("789", vm.getStack().pop());
    assertEquals("9", vm.getStack().pop());
    assertEquals("123", vm.getStack().pop());
View Full Code Here

      " title empty$ " + // FALSE
      " \" HALLO \" empty$ } ITERATE {test} ");

    Vector<BibtexEntry> v = new Vector<BibtexEntry>();
    v.add(bibtexString2BibtexEntry("@article{a, author=\"AAA\"}"));
    vm.run(v);
    assertEquals(VM.FALSE, vm.getStack().pop());
    assertEquals(VM.TRUE, vm.getStack().pop());
    assertEquals(VM.TRUE, vm.getStack().pop());
    assertEquals(VM.TRUE, vm.getStack().pop());
    assertEquals(VM.TRUE, vm.getStack().pop());
View Full Code Here

    VM vm = new VM("FUNCTION {emphasize} " + "{ duplicate$ empty$ " + "  { pop$ \"\" } "
      + "  { \"{\\em \" swap$ * \"}\" * } " + "  if$ " + "} " + "FUNCTION {test} {"
      + "  \"\" emphasize " + "  \"Hello\" emphasize " + "}" + "EXECUTE {test} ");

    Vector<BibtexEntry> v = new Vector<BibtexEntry>();
    vm.run(v);
    assertEquals("{\\em Hello}", vm.getStack().pop());
    assertEquals("", vm.getStack().pop());
    assertEquals(0, vm.getStack().size());
  }

View Full Code Here

        + "  \"\" format.title "
        + "  \"{A}{D}/{C}ycle: {I}{B}{M}'s {F}ramework for {A}pplication {D}evelopment and {C}ase\" \"u\" change.case$ format.title "
        + "}" + "EXECUTE {test} ");

    Vector<BibtexEntry> v = new Vector<BibtexEntry>();
    vm.run(v);
    assertEquals(
      "{A}{D}/{C}ycle: {I}{B}{M}'s {F}ramework for {A}pplication {D}evelopment and {C}ase",
      vm.getStack().pop());
    assertEquals("", vm.getStack().pop());
    assertEquals("Hello world", vm.getStack().pop());
View Full Code Here

      + "  \"{\\This {is} {one} {c{h}}aracter as well}\" text.length$ "
      + "  \"{\\And this too\" text.length$ " + "  \"These are {\\11}\" text.length$ " + "} "
      + "EXECUTE {test} ");

    Vector<BibtexEntry> v = new Vector<BibtexEntry>();
    vm.run(v);
    assertEquals(new Integer(11), vm.getStack().pop());
    assertEquals(new Integer(1), vm.getStack().pop());
    assertEquals(new Integer(1), vm.getStack().pop());
    assertEquals(new Integer(1), vm.getStack().pop());
    assertEquals(new Integer(8), vm.getStack().pop());
View Full Code Here

  public void testVMIntToStr() throws RecognitionException, IOException {
    VM vm = new VM("FUNCTION {test} { #3 int.to.str$ #9999 int.to.str$}" + "EXECUTE {test}");

    Vector<BibtexEntry> v = new Vector<BibtexEntry>();
    vm.run(v);
    assertEquals("9999", (String) vm.getStack().pop());
    assertEquals("3", vm.getStack().pop());
    assertEquals(0, vm.getStack().size());
  }
View Full Code Here

  public void testVMChrToInt() throws RecognitionException, IOException {
    {
      VM vm = new VM("FUNCTION {test} { \"H\" chr.to.int$ }" + "EXECUTE {test}");

      Vector<BibtexEntry> v = new Vector<BibtexEntry>();
      vm.run(v);
      assertEquals(new Integer(72), vm.getStack().pop());
      assertEquals(0, vm.getStack().size());
    }
    {
      VM vm = new VM("FUNCTION {test} { \"H\" chr.to.int$ int.to.chr$ }" + "EXECUTE {test}");
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.