mirror of
https://github.com/atom/atom.git
synced 2026-02-06 04:34:55 -05:00
Defer building parser until eval'ing
This commit is contained in:
@@ -4,9 +4,9 @@ PEG = require 'pegjs'
|
||||
module.exports =
|
||||
class CommandInterpreter
|
||||
constructor: (@project) ->
|
||||
@parser = PEG.buildParser(fs.read(require.resolve 'command-panel/commands.pegjs'))
|
||||
|
||||
eval: (string, activeEditSession) ->
|
||||
@parser ?= PEG.buildParser(fs.read(require.resolve 'command-panel/commands.pegjs'))
|
||||
compositeCommand = @parser.parse(string)
|
||||
@lastRelativeAddress = compositeCommand if compositeCommand.isRelativeAddress()
|
||||
compositeCommand.execute(@project, activeEditSession)
|
||||
|
||||
Reference in New Issue
Block a user