1
0
Fork 0
mirror of https://github.com/jashkenas/coffeescript.git synced 2022-11-09 12:23:24 -05:00

Merge pull request #3151 from kchmck/master

Fix some inconsistent indentation
This commit is contained in:
Michael Ficarra 2013-09-03 16:33:27 -07:00
commit 40c1086efa
4 changed files with 22 additions and 22 deletions

View file

@ -219,7 +219,7 @@ grammar =
o 'ParamVar = Expression', -> new Param $1, $3
]
# Function Parameters
# Function Parameters
ParamVar: [
o 'Identifier'
o 'ThisProperty'

View file

@ -99,23 +99,23 @@ buildLocationData = (first, last) ->
# object is an AST node, updates that object's locationData.
# The object is returned either way.
exports.addLocationDataFn = (first, last) ->
(obj) ->
if ((typeof obj) is 'object') and (!!obj['updateLocationDataIfMissing'])
obj.updateLocationDataIfMissing buildLocationData(first, last)
(obj) ->
if ((typeof obj) is 'object') and (!!obj['updateLocationDataIfMissing'])
obj.updateLocationDataIfMissing buildLocationData(first, last)
return obj
return obj
# Convert jison location data to a string.
# `obj` can be a token, or a locationData.
exports.locationDataToString = (obj) ->
if ("2" of obj) and ("first_line" of obj[2]) then locationData = obj[2]
else if "first_line" of obj then locationData = obj
if ("2" of obj) and ("first_line" of obj[2]) then locationData = obj[2]
else if "first_line" of obj then locationData = obj
if locationData
"#{locationData.first_line + 1}:#{locationData.first_column + 1}-" +
"#{locationData.last_line + 1}:#{locationData.last_column + 1}"
else
"No location data"
if locationData
"#{locationData.first_line + 1}:#{locationData.first_column + 1}-" +
"#{locationData.last_line + 1}:#{locationData.last_column + 1}"
else
"No location data"
# A `.coffee.md` compatible version of `basename`, that returns the file sans-extension.
exports.baseFileName = (file, stripExt = no, useWinPathSep = no) ->

View file

@ -45,9 +45,9 @@ exports.Lexer = class Lexer
@tokens = [] # Stream of parsed tokens in the form `['TYPE', value, location data]`.
@chunkLine =
opts.line or 0 # The start line for the current @chunk.
opts.line or 0 # The start line for the current @chunk.
@chunkColumn =
opts.column or 0 # The start column of the current @chunk.
opts.column or 0 # The start column of the current @chunk.
code = @clean code # The stripped, cleaned original source code.
# At every position, run through this list of attempted matches,
@ -84,8 +84,8 @@ exports.Lexer = class Lexer
code = code.slice(1) if code.charCodeAt(0) is BOM
code = code.replace(/\r/g, '').replace TRAILING_SPACES, ''
if WHITESPACE.test code
code = "\n#{code}"
@chunkLine--
code = "\n#{code}"
@chunkLine--
code = invertLiterate code if @literate
code

View file

@ -7,9 +7,9 @@
# Create a generated token: one that exists due to a use of implicit syntax.
generate = (tag, value) ->
tok = [tag, value]
tok.generated = yes
tok
tok = [tag, value]
tok.generated = yes
tok
# The **Rewriter** class is used by the [Lexer](lexer.html), directly against
# its internal array of tokens.
@ -341,11 +341,11 @@ class exports.Rewriter
return 1 if token[2]
return 1 unless token.generated or token.explicit
if token[0] is '{' and nextLocation=tokens[i + 1]?[2]
{first_line: line, first_column: column} = nextLocation
{first_line: line, first_column: column} = nextLocation
else if prevLocation = tokens[i - 1]?[2]
{last_line: line, last_column: column} = prevLocation
{last_line: line, last_column: column} = prevLocation
else
line = column = 0
line = column = 0
token[2] =
first_line: line
first_column: column