Skip to content
Snippets Groups Projects
Select Git revision
  • e6d41f7015e7ac6891fb7dbfbc020664b82efd05
  • develop default protected
  • master protected
  • kristin_optim_test
  • 3.9.0
  • 3.8.0
  • 3.7.0
  • 3.6.0
  • 3.5.0
  • 3.4.1
  • 3.4.0
  • 3.3.3
  • 3.3.2
  • 3.3.0
  • 3.2.14
  • 3.2.13
  • 3.2.12
17 results

PositionedNode.java

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    PositionedNode.java 1.14 KiB
    /*
     * (c) 2009 Lehrstuhl fuer Softwaretechnik und Programmiersprachen, 
     * Heinrich Heine Universitaet Duesseldorf
     * This software is licenced under EPL 1.0 (http://www.eclipse.org/org/documents/epl-v10.html) 
     * */
    
    package de.hhu.stups.sablecc.patch;
    
    public class PositionedNode {
    	private SourcePosition startPos;
    	private SourcePosition endPos;
    
    	public SourcePosition getStartPos() {
    		/*
    		 * Special treatment for tokens because they don't get a position in the
    		 * PositionAspect
    		 */
    		if (this instanceof IToken) {
    			final IToken token = (IToken) this;
    			return new SourcePosition(token.getLine(), token.getPos());
    		}
    
    		return startPos;
    	}
    
    	public SourcePosition getEndPos() {
    		/*
    		 * Special treatment for tokens because they don't get a position in the
    		 * PositionAspect
    		 */
    		if (this instanceof IToken) {
    			final IToken token = (IToken) this;
    			return new SourcePosition(token.getLine(), token.getPos()
    					+ token.getText().length());
    		}
    
    		return endPos;
    	}
    
    	public void setStartPos(final SourcePosition startPos) {
    		this.startPos = startPos;
    	}
    
    	public void setEndPos(final SourcePosition endPos) {
    		this.endPos = endPos;
    	}
    }