Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conflicts: build.sbt core/markdown/src/main/scala/net/liftweb/markdown/BaseParsers.scala core/markdown/src/test/scala/net/liftweb/markdown/LineTokenizerTest.scala core/util/src/test/scala/net/liftweb/util/BindHelpersSpec.scala core/util/src/test/scala/net/liftweb/util/CssSelectorSpec.scala core/util/src/test/scala/net/liftweb/util/TimeHelpersSpec.scala core/util/src/test/scala/net/liftweb/util/VCardParserSpec.scala persistence/mapper/src/main/scala/net/liftweb/mapper/MetaMapper.scala persistence/mongodb/src/main/scala/net/liftweb/mongodb/Mongo.scala persistence/mongodb/src/test/scala/net/liftweb/mongodb/MongoDirectSpec.scala persistence/mongodb/src/test/scala/net/liftweb/mongodb/MongoDocumentExamplesSpec.scala persistence/record/src/test/scala/net/liftweb/record/RecordSpec.scala project/Build.scala project/Dependencies.scala web/webkit/src/main/scala/net/liftweb/http/CometActor.scala web/webkit/src/main/scala/net/liftweb/http/LiftRules.scala web/webkit/src/main/scala/net/liftweb/http/LiftSession.scala
- Loading branch information
Showing
80 changed files
with
1,500 additions
and
510 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
/* __ *\ | ||
** ________ ___ / / ___ Scala API ** | ||
** / __/ __// _ | / / / _ | (c) 2003-2013, LAMP/EPFL ** | ||
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ ** | ||
** /____/\___/_/ |_/____/_/ | | ** | ||
** |/ ** | ||
\* */ | ||
|
||
package scala | ||
package io | ||
|
||
/** The object Position provides convenience methods to encode | ||
* line and column number in one single integer. The encoded line | ||
* (column) numbers range from 0 to `LINE_MASK` (`COLUMN_MASK`), | ||
* where `0` indicates that the line (column) is undefined and | ||
* `1` represents the first line (column). | ||
* | ||
* Line (Column) numbers greater than `LINE_MASK` (`COLUMN_MASK`) are | ||
* replaced by `LINE_MASK` (`COLUMN_MASK`). Furthermore, if the encoded | ||
* line number is `LINE_MASK`, the column number is always set to 0. | ||
* | ||
* The following properties hold: | ||
* | ||
* the undefined position is 0: `encode(0,0) == 0` | ||
* encodings are non-negative : `encode(line,column) >= 0` | ||
* position order is preserved: | ||
* {{{ | ||
* (line1 <= line2) || (line1 == line2 && column1 <= column2) | ||
* }}} | ||
* implies | ||
* {{{ | ||
* encode(line1,column1) <= encode(line2,column2) | ||
* }}} | ||
* @author Burak Emir (translated from work by Matthias Zenger and others) | ||
*/ | ||
|
||
/** | ||
* This was made private in scala 2.11.0 but there is no alternative for us to use, so here, copy/paste for now. | ||
*/ | ||
|
||
@deprecated("This class will be removed.", "2.10.0") | ||
abstract class Position { | ||
/** Definable behavior for overflow conditions. | ||
*/ | ||
def checkInput(line: Int, column: Int): Unit | ||
|
||
/** Number of bits used to encode the line number */ | ||
final val LINE_BITS = 20 | ||
/** Number of bits used to encode the column number */ | ||
final val COLUMN_BITS = 31 - LINE_BITS // no negatives => 31 | ||
/** Mask to decode the line number */ | ||
final val LINE_MASK = (1 << LINE_BITS) - 1 | ||
/** Mask to decode the column number */ | ||
final val COLUMN_MASK = (1 << COLUMN_BITS) - 1 | ||
|
||
/** Encodes a position into a single integer. */ | ||
final def encode(line: Int, column: Int): Int = { | ||
checkInput(line, column) | ||
|
||
if (line >= LINE_MASK) | ||
LINE_MASK << COLUMN_BITS | ||
else | ||
(line << COLUMN_BITS) | scala.math.min(COLUMN_MASK, column) | ||
} | ||
|
||
/** Returns the line number of the encoded position. */ | ||
final def line(pos: Int): Int = (pos >> COLUMN_BITS) & LINE_MASK | ||
|
||
/** Returns the column number of the encoded position. */ | ||
final def column(pos: Int): Int = pos & COLUMN_MASK | ||
|
||
/** Returns a string representation of the encoded position. */ | ||
def toString(pos: Int): String = line(pos) + ":" + column(pos) | ||
} | ||
|
||
object Position extends Position { | ||
def checkInput(line: Int, column: Int) { | ||
if (line < 0) | ||
throw new IllegalArgumentException(line + " < 0") | ||
if ((line == 0) && (column != 0)) | ||
throw new IllegalArgumentException(line + "," + column + " not allowed") | ||
if (column < 0) | ||
throw new IllegalArgumentException(line + "," + column + " not allowed") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.