mirror of
https://github.com/atom/atom.git
synced 2026-01-23 22:08:08 -05:00
Add explicit ZeroAddress object to command language AST
This commit is contained in:
@@ -1,9 +1,10 @@
|
||||
{
|
||||
var CompositeCommand = require('command-panel/commands/composite-command')
|
||||
var Substitution = require('command-panel/commands/substitution');
|
||||
var ZeroAddress = require('command-panel/commands/zero-address');
|
||||
var EofAddress = require('command-panel/commands/eof-address');
|
||||
var LineAddress = require('command-panel/commands/line-address');
|
||||
var AddressRange = require('command-panel/commands/address-range');
|
||||
var EofAddress = require('command-panel/commands/eof-address');
|
||||
var CurrentSelectionAddress = require('command-panel/commands/current-selection-address')
|
||||
var RegexAddress = require('command-panel/commands/regex-address')
|
||||
var SelectAllMatches = require('command-panel/commands/select-all-matches')
|
||||
@@ -19,15 +20,16 @@ address = addressRange / primitiveAddress
|
||||
|
||||
addressRange
|
||||
= start:primitiveAddress? _ ',' _ end:address? {
|
||||
if (!start) start = new LineAddress(0)
|
||||
if (!start) start = new ZeroAddress()
|
||||
if (!end) end = new EofAddress()
|
||||
return new AddressRange(start, end)
|
||||
}
|
||||
|
||||
primitiveAddress
|
||||
= lineNumber:integer { return new LineAddress(lineNumber) }
|
||||
= '0' { return new ZeroAddress() }
|
||||
/ '$' { return new EofAddress() }
|
||||
/ '.' { return new CurrentSelectionAddress() }
|
||||
/ lineNumber:integer { return new LineAddress(lineNumber) }
|
||||
/ regexAddress
|
||||
|
||||
regexAddress
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
Address = require 'command-panel/commands/address'
|
||||
Range = require 'range'
|
||||
|
||||
module.exports =
|
||||
class ZeroAddress extends Address
|
||||
getRange: (editor) ->
|
||||
new Range([0, 0], [0, 0])
|
||||
|
||||
isRelative: -> false
|
||||
Reference in New Issue
Block a user