|
From: Zach D. <zd...@us...> - 2005-08-06 02:46:27
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6438/src/org/rubypeople/rdt/internal/core/parser Modified Files: RdtPositionFactory.java MarkerUtility.java RdtPosition.java Log Message: Updated for new jruby changes in regards to start and stop line positions for ruby classes, methods, variables, etc... Index: RdtPositionFactory.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/RdtPositionFactory.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RdtPositionFactory.java 2 Mar 2005 00:54:04 -0000 1.2 --- RdtPositionFactory.java 6 Aug 2005 02:46:18 -0000 1.3 *************** *** 25,35 **** */ public ISourcePosition getPosition(LexerSource source, ISourcePosition startPosition) { ! int start = 0; ! // int line = 1; ! if(startPosition != null) { ! start = startPosition.getEndOffset(); ! // line = startPosition.getLine(); } - return new RdtPosition(source.getLine(), start, source.getOffset()); } --- 25,44 ---- */ public ISourcePosition getPosition(LexerSource source, ISourcePosition startPosition) { ! int startOffset = 0; ! ! /* If startPosition is null then we are starting a new block/token of ! * ruby code. */ ! if( startPosition == null ){ ! return new RdtPosition( source.getLine(), startOffset+1, ! source.getOffset() ); } ! ! /* If startPosition isn't null then we are closing an existing ! * block/token of ruby code, and the source.getLine() is the line that ! * the block/token of ruby code ends on.*/ ! else{ ! startOffset = startPosition.getEndOffset(); ! return new RdtPosition( startPosition.getStartLine(), ! source.getLine(), startOffset, source.getOffset() ); } } Index: MarkerUtility.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/MarkerUtility.java,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** MarkerUtility.java 16 Jul 2005 22:26:30 -0000 1.6 --- MarkerUtility.java 6 Aug 2005 02:46:18 -0000 1.7 *************** *** 38,42 **** map.put(IMarker.MESSAGE, syntaxException.getMessage()); map.put(IMarker.USER_EDITABLE, Boolean.FALSE); ! map.put(IMarker.LINE_NUMBER, new Integer(pos.getLine())); map.put(IMarker.CHAR_START, new Integer(pos.getStartOffset())); map.put(IMarker.CHAR_END, new Integer(pos.getEndOffset())); --- 38,42 ---- map.put(IMarker.MESSAGE, syntaxException.getMessage()); map.put(IMarker.USER_EDITABLE, Boolean.FALSE); ! map.put(IMarker.LINE_NUMBER, new Integer(pos.getStartLine())); map.put(IMarker.CHAR_START, new Integer(pos.getStartOffset())); map.put(IMarker.CHAR_END, new Integer(pos.getEndOffset())); Index: RdtPosition.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.core/src/org/rubypeople/rdt/internal/core/parser/RdtPosition.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** RdtPosition.java 2 Mar 2005 00:54:04 -0000 1.2 --- RdtPosition.java 6 Aug 2005 02:46:18 -0000 1.3 *************** *** 12,29 **** **/ public class RdtPosition implements ISourcePosition { ! private int start; ! private int end; ! private int line; /** * */ ! public RdtPosition(int line, int startOffset, int endOffset) { ! this.line = line; ! this.start = startOffset; ! this.end = endOffset; ! } ! /* (non-Javadoc) * @see org.jruby.lexer.yacc.ISourcePosition#getFile() --- 12,39 ---- **/ public class RdtPosition implements ISourcePosition { + + private int startLine; + private int endLine; ! private int startOffset; ! private int endOffset; ! ! public RdtPosition( int startLine, int startOffset, int endOffset ){ ! this.startLine = startLine; ! this.endLine = startLine; ! this.startOffset = startOffset; ! this.endOffset = endOffset; ! } /** * */ ! public RdtPosition( int startLine, int endLine, int startOffset, ! int endOffset ){ ! this.startLine = startLine; ! this.endLine = endLine; ! this.startOffset = startOffset; ! this.endOffset = endOffset; } ! /* (non-Javadoc) * @see org.jruby.lexer.yacc.ISourcePosition#getFile() *************** *** 33,42 **** } - /* (non-Javadoc) - * @see org.jruby.lexer.yacc.ISourcePosition#getLine() - */ - public int getLine() { - return line; - } /* (non-Javadoc) --- 43,46 ---- *************** *** 44,48 **** */ public int getStartOffset() { ! return start; } --- 48,52 ---- */ public int getStartOffset() { ! return startOffset; } *************** *** 51,55 **** */ public int getEndOffset() { ! return end; } --- 55,59 ---- */ public int getEndOffset() { ! return endOffset; } *************** *** 59,63 **** */ public String toString() { ! return "line " + getLine() + ": (" + getStartOffset() +".." + getEndOffset() + ")"; } --- 63,78 ---- */ public String toString() { ! return "start line: " + getStartLine() + ", end line: " + getEndLine() ! + ", (" + getStartOffset() + ".." + getEndOffset() + ")"; ! } ! ! public int getStartLine() { ! // TODO Auto-generated method stub ! return startLine; ! } ! ! public int getEndLine() { ! // TODO Auto-generated method stub ! return endLine; } |