Package net.gereon.jloom.translation.translator

Examples of net.gereon.jloom.translation.translator.SimpleTranslationMapping$Checkpoint


    CharArrayWriter w = (CharArrayWriter) gc.getOut();
    int generatorPos = w.size();
    if (!newToken) {
      generatorPos--;
    }
    SimpleTranslationMapping tm = (SimpleTranslationMapping) tc.getTranslationMapping();
    tm.addCheckpoint(templatePos, generatorPos, false);
  }
View Full Code Here


    String s = scriptlet.getScriptletPart().getText(); //.trim();
    if (s.equals("")) { return; }
   
    int start = scriptlet.getScriptletPart().getInputRange().getStart();
    CharArrayWriter w = (CharArrayWriter) gc.getOut();
    SimpleTranslationMapping tm = (SimpleTranslationMapping) tc.getTranslationMapping();
   
    LinedString l = new LinedString(s);
    int firstLine = 0;
    int lastLine = l.getLineCount() - 1;
    if (l.getLine(firstLine).trim().equals("")) {
      firstLine++;
    }
    if (l.getLine(lastLine).trim().equals("")) {
      lastLine--;
    }
    if (firstLine > lastLine) {
      return;
    }
    String[] lines = l.getLinesArray(firstLine, lastLine);
    int ws = TranslationTools.getCommonLeadingWhitespace(lines).length();
   
    for (int i=firstLine; i<=lastLine; i++) {
      GenerationTools.print(gc, ""); // for indention
      String line = l.getLine(i).substring(ws);
      int templatePos = start + l.getPosition(i) + ws;
      int generatorPos = w.size();
      tm.addCheckpoint(templatePos, generatorPos, true);
      GenerationTools.println(gc, line);
    }
  }
View Full Code Here

TOP

Related Classes of net.gereon.jloom.translation.translator.SimpleTranslationMapping$Checkpoint

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.