Ruby parsing for Notepad++ Function List panel
I have a work-in-progress on Gist:
https://gist.github.com/monban/6133403
It reads functions, but does not correctly parse classes / modules. Please feel free to fork and improve.
How set tcl language parsing rules in function list - notepad++ plugin
Never mind,
Notepad+= 5.4.5 unicode and function list 2.0 beta. I have succeded with
<Group name="Global Procedures" subgroup="" icon="8" child="16" autoexp="4" matchcase="0" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg="^proc\s+" regexfunc="[\w_]+" regexend="" bodybegin="{" bodyend="}" sep="" /> </Group> <Group name="Namespaces" subgroup="" icon="0" child="0" autoexp="4" matchcase="1" fendtobbeg="" bbegtobend="" keywords=""> <Rules regexbeg="^namespace\s+eval\s+::" regexfunc="[\w_]+" regexend="" bodybegin="" bodyend="" sep="" /> </Group>
Notepad++ Function List plugin: Javascript parsing rules to support nested functions
Remove the "body begin" and "body end" characters and it will work:
<Group name="Functions" subgroup="" icon="" child="" autoexp="0" matchcase="0" fendtobbeg="" bbegtobend="" keywords="">
<Rules regexbeg="^\s*function" regexfunc='\s*["\w_]+' regexend="" bodybegin="" bodyend="" sep="" />
</Group>
(this example works only for the first type of functions you have put as an example)
Does anyone have a Notepad++ plugin that will generate UUIDs and insert them
Install the GhNppExec plugin from Plugin Central, then configure to run the simple Python script below.
Use the shortcut mapper to assign a key combination to the plugin command.
import uuid
import sys
# make a random UUID
sys.stdout.write(str(uuid.uuid4()).upper())
Rake rules to generate multiple targets from single source/dependency
Do you need a rule for it?
You may try to create multiple file tasks for it:
n = 1..6 #Your n-Array
n.each do |i|
targetfile = 'file_c%i.dst' % i #Define the file to be created
desc 'Create %s based n %s' % [ targetfile, 'file_c.src']
file targetfile => 'file_c.src' do |task| #Define task to create targetfile
puts "cmd1 -o #{task.name} -i #{task.source}" #Command to create targetfile
end
end
In my tests I had no problem to combine it with the already defined rule.
Below my complete testcode:
require 'rake'
src_files = Rake::FileList["*.src"]
dst_files = src_files.ext 'dst'
task :default => dst_files
def build_dst(dst, src)
puts "cmd -o #{dst} -i #{src}" #Command to create targetfile
File.open(dst,'w'){|f|} #Dummy to simulate generation
end
rule '.dst' => '.src' do |task|
build_dst task.name, task.source
end
N = 1..6 #array of numbers.
N.each do |i|
targetfile = 'file_c%i.dst' % i #Define the file to be created
desc 'Create %s based n %s' % [ targetfile, 'file_c.src']
file targetfile => 'file_c.src' do |task| #Define task to create targetfile
build_dst task.name, task.source
end
end
#Make dummy-sources.
File.open('file_c.src','w'){|f|}
File.open('x.src','w'){|f|}
Rake.application['x.dst'].invoke
Rake.application['file_c3.dst'].invoke
You will see, the commands are exectuted as expected:
cmd -o x.dst -i x.src
cmd -o file_c3.dst -i file_c.src
One addition - out of the scope of your question:
I have some problems to see a real use case of your question.
If the command to generate file_c<n>.dst
depends only on the same sourcecode, then the generated dst-files would be the same - you could just copy the result. I would expect some other differences in dependecies.
If your file_c<n>.dst
depends an file_c<n>.src
and file_c.src
then you could use something like:
require 'rake'
rule '.dst' => '.src' do |task|
puts "cmd -o #{task.name} -i #{task.prerequisites}" #Command to create targetfile
File.open(task.name,'w'){} #Dummy to simulate generation
end
#Add additional prerequsites (cold also defined generic)
file 'file_c3.dst' => 'file_c.src'
#Make dummy-sources.
#~ File.open('file_c.src','w'){|f|}
#~ File.open('file_c3.src','w'){|f|}
Rake.application['file_c3.dst'].invoke
I add additional prerequisites and replaced task.source
by task.prerequisites
.
Related Topics
Ruby Error Reading in Certificate File with Openssl
What's Wrong with the Square and Rectangle Inheritance
Ruby How to Merge Two CSV Files with Slightly Different Headers
How to Include Unit Tests in a Ruby Module
Rails 3 Caching: Expire Action for Named Route
How to Search for Useful Ruby Gems
Ruby on Rails: Radio Buttons for Collection Select
Uninstall Ruby on Rails on MAC Os X 10.6
Ruby on Rails - Activerecord::Relation Count Method Is Wrong
How to Ssh Interactive Session
What's the Difference Between the Ruby Irb Prompt Modes
Detect Similar Sounding Words in Ruby
Ruby -- Capitalize First Letter of Every Sentence in a Paragraph
Routing Error No Route Matches [Get] "/Static_Pages/Home", Tutorial
Selenium Webdriver Getting a Cookie Value