diff options
author | michelou <michelou@epfl.ch> | 2006-09-26 14:16:35 +0000 |
---|---|---|
committer | michelou <michelou@epfl.ch> | 2006-09-26 14:16:35 +0000 |
commit | 40396d951e31745af414748b1508012f823f2343 (patch) | |
tree | 896000986c37b51e533726ec28e56fce0ac79aa2 /src/compiler/scala/tools/nsc/util/CharArrayReader.scala | |
parent | 20aa9911d0ee9ed96b2f12642e8e8505782cbc0b (diff) | |
download | scala-40396d951e31745af414748b1508012f823f2343.tar.gz scala-40396d951e31745af414748b1508012f823f2343.tar.bz2 scala-40396d951e31745af414748b1508012f823f2343.zip |
removed leading/trailing tabs/blanks in nsc/uti...
removed leading/trailing tabs/blanks in nsc/util/*.scala
Diffstat (limited to 'src/compiler/scala/tools/nsc/util/CharArrayReader.scala')
-rw-r--r-- | src/compiler/scala/tools/nsc/util/CharArrayReader.scala | 69 |
1 files changed, 35 insertions, 34 deletions
diff --git a/src/compiler/scala/tools/nsc/util/CharArrayReader.scala b/src/compiler/scala/tools/nsc/util/CharArrayReader.scala index 182a730694..ffe41b0f72 100644 --- a/src/compiler/scala/tools/nsc/util/CharArrayReader.scala +++ b/src/compiler/scala/tools/nsc/util/CharArrayReader.scala @@ -1,9 +1,10 @@ -/* NSC -- new scala compiler - * Copyright 2005 LAMP/EPFL +/* NSC -- new Scala compiler + * Copyright 2005-2006 LAMP/EPFL * @author Martin Odersky */ // $Id$ -package scala.tools.nsc.util; + +package scala.tools.nsc.util import scala.tools.nsc.util.SourceFile.{LF, FF, CR, SU} @@ -11,35 +12,35 @@ class CharArrayReader(buf: Array[char], start: int, /* startline: int, startcol: decodeUni: boolean, error: String => unit) { def this(buf: Array[char], decodeUni: boolean, error: String => unit) = - this(buf, 0, /* 1, 1, */ decodeUni, error); + this(buf, 0, /* 1, 1, */ decodeUni, error) /** layout constant */ - val tabinc = 8; + val tabinc = 8 /** the line and column position of the current character */ - var ch: char = _; - var bp = start; - //private var cline: int = _; - //private var ccol: int = _; - def cpos = bp; - var isUnicode: boolean = _; - var lastLineStartPos: int = 0; - var lineStartPos: int = 0; - //private var nextline = startline; - //private var nextcol = startcol; + var ch: char = _ + var bp = start + //private var cline: int = _ + //private var ccol: int = _ + def cpos = bp + var isUnicode: boolean = _ + var lastLineStartPos: int = 0 + var lineStartPos: int = 0 + //private var nextline = startline + //private var nextcol = startcol - def hasNext: boolean = bp < buf.length; + def hasNext: boolean = bp < buf.length - def last: char = if(bp > start + 2) buf(bp - 2) else ' '; // XML literals + def last: char = if(bp > start + 2) buf(bp - 2) else ' ' // XML literals def next: unit = { - //cline = nextline; - //ccol = nextcol; - ch = buf(bp); - isUnicode = false; - bp = bp + 1; + //cline = nextline + //ccol = nextcol + ch = buf(bp) + isUnicode = false + bp = bp + 1 ch match { case '\t' => // nextcol = ((nextcol - 1) / tabinc * tabinc) + tabinc + 1; @@ -47,35 +48,35 @@ class CharArrayReader(buf: Array[char], start: int, /* startline: int, startcol: //nextline = nextline + 1; // nextcol = 1; if (buf(bp) == LF) { - ch = LF; + ch = LF bp = bp + 1 } - lastLineStartPos = lineStartPos; - lineStartPos = bp; + lastLineStartPos = lineStartPos + lineStartPos = bp case LF | FF => - lastLineStartPos = lineStartPos; - lineStartPos = bp; - //nextline = nextline + 1; + lastLineStartPos = lineStartPos + lineStartPos = bp + //nextline = nextline + 1 //nextcol = 1 case '\\' => def evenSlashPrefix: boolean = { - var p = bp - 2; + var p = bp - 2 while (p >= 0 && buf(p) == '\\') p = p - 1; (bp - p) % 2 == 0 } def udigit: int = { - val d = digit2int(buf(bp), 16); + val d = digit2int(buf(bp), 16) if (d >= 0) { bp = bp + 1; /* nextcol = nextcol + 1 */ } else error("error in unicode escape"); d } - // nextcol = nextcol + 1; + // nextcol = nextcol + 1 if (buf(bp) == 'u' && decodeUni && evenSlashPrefix) { do { bp = bp + 1; // nextcol = nextcol + 1; } while (buf(bp) == 'u'); - val code = udigit << 12 | udigit << 8 | udigit << 4 | udigit; - ch = code.asInstanceOf[char]; + val code = udigit << 12 | udigit << 8 | udigit << 4 | udigit + ch = code.asInstanceOf[char] isUnicode = true } case _ => @@ -84,7 +85,7 @@ class CharArrayReader(buf: Array[char], start: int, /* startline: int, startcol: } def copy: CharArrayReader = - new CharArrayReader(buf, bp, /* nextcol, nextline, */ decodeUni, error); + new CharArrayReader(buf, bp, /* nextcol, nextline, */ decodeUni, error) def digit2int(ch: char, base: int): int = { if ('0' <= ch && ch <= '9' && ch < '0' + base) |