Skip to content
Snippets Groups Projects
Select Git revision
  • d6128d34b01b4a58cd7186cb7c7fe5b9a485fef6
  • master default protected
  • release
  • v2.2.0
  • v2.1.1
  • v2.1.0
  • v2.0.5
  • v2.0.2
  • v2.0.1
  • v2.0.0
  • v1.3.4
  • v1.5.0
  • v1.4.0
  • v1.3.3
  • v1.3.2
  • v1.3.1
  • v1.3
  • v1.2
  • v1.1
  • v1.0
  • 0.0.1
  • 0.0.2
22 results

settings.gradle.kts

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;
    	}
    }