2009-07-01から1ヶ月間の記事一覧
まんま #!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.vertical_line 100, 300, :at => 25 pdf.stroke pdf.render_file(File.basename($0, ".rb") + ".pdf")
import org.apache.commons.lang.builder.StandardToStringStyle; public class C2009073100 { public static void main(String[] args) { StandardToStringStyle x = new StandardToStringStyle(); System.out.println(x.getContentStart()); x.setContentS…
まんま >>> from lepl import * >>> next( Word().match('hello world') ) (['hello'], ' world') >>> next( Integer().match('123 four five') ) (['123'], ' four five') >>> next( And(Word(), Space(), Integer()).match('hello 123') ) (['hello', ' ',…
#!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.rectangle [300,300], 100, 200 pdf.stroke_bounds pdf.render_file(File.basename($0, ".rb") + ".pdf")
import org.apache.commons.lang.builder.StandardToStringStyle; public class C2009073000 { public static void main(String[] args) { StandardToStringStyle x = new StandardToStringStyle(); System.out.println(x.getContentEnd()); x.setContentEnd…
まんま >>> from lepl import * >>> name = Word() > 'name' >>> phone = Integer() > 'phone' >>> matcher = name / ',' / phone > make_dict >>> parser = matcher.string_parser() >>> parser('andrew, 3333253') [{'phone': '3333253', 'name': 'andrew'…
まんま #!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.rectangle [300,300], 100, 200 pdf.stroke pdf.render_file(File.basename($0, ".rb") + ".pdf")
import org.apache.commons.lang.builder.StandardToStringStyle; public class C2009072900 { public static void main(String[] args) { StandardToStringStyle x = new StandardToStringStyle(); System.out.println(x.getArrayStart()); x.setArrayStart…
まんま >>> from lepl import * >>> from operator import add, sub, mul, truediv >>> class Op(Node): ... def __float__(self): ... return self._op(float(self[0]), float(self[1])) ... >>> class Add(Op): _op = add ... >>> class Sub(Op): _op = su…
まんま #!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.polygon [100,100], [100,200], [200,200] pdf.stroke pdf.render_file(File.basename($0, ".rb") + ".pdf")
import org.apache.commons.lang.builder.StandardToStringStyle; public class C2009072800 { public static void main(String[] args) { StandardToStringStyle x = new StandardToStringStyle(); System.out.println(x.getArraySeparator()); x.setArrayS…
まんま >>> from lepl import * >>> class Add(Node): pass ... >>> class Sub(Node): pass ... >>> class Mul(Node): pass ... >>> class Div(Node): pass ... >>> symbol = Token('[^0-9a-zA-Z \t\r\n]') >>> value = Token(UnsignedFloat()) >>> negfloat…
#!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.move_to [100, 100] pdf.line_to [50, 50] pdf.move_to(200, 200) pdf.line_to [250, 250] pdf.stroke pdf.render_file(File.basename($0, ".rb") + ".pdf")
import org.apache.commons.lang.builder.StandardToStringStyle; public class C2009072700 { public static void main(String[] args) { StandardToStringStyle x = new StandardToStringStyle(); System.out.println(x.getArrayEnd()); x.setArrayEnd("]"…
まんま >>> from lepl import * >>> symbol = Token('[^0-9a-zA-Z \t\r\n]') >>> value = Token(UnsignedFloat()) >>> negfloat = lambda x: -float(x) >>> number = Or(value >> float, ~symbol('-') & value >> negfloat) >>> group2, group3 = Delayed(),…
#!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new p pdf.line_width pdf.line_width = 5 p pdf.line_width pdf.move_to [100, 100] pdf.line_to [50, 50] pdf.stroke pdf.render_file(File.basename($0, ".rb") + ".pdf") で、 1 5
import org.apache.commons.lang.builder.StandardToStringStyle; public class C2009072600 { public static void main(String[] args) { StandardToStringStyle x = new StandardToStringStyle(); System.out.println(x.isArrayContentDetail()); x.setArr…
まんま >>> from lepl import * >>> symbol = Token('[^0-9a-zA-Z \t\r\n]') >>> value = Token(UnsignedFloat()) >>> negfloat = lambda x: -float(x) >>> number = Or(value >> float, ... ~symbol('-') & value >> negfloat) >>> group2, group3 = Delaye…
まんま #!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new p pdf.line_width pdf.line_width(5) p pdf.line_width pdf.move_to [100, 100] pdf.line_to [50, 50] pdf.stroke pdf.render_file(File.basename($0, ".rb") + ".pdf") で、 1 5
import org.apache.commons.lang.builder.StandardToStringStyle; public class C2009072500 { public static void main(String[] args) { System.out.println(new StandardToStringStyle().isUseShortClassName()); } } で、 false
まんま >>> from lepl import * >>> symbol = Token('[^0-9a-zA-Z \t\r\n]') >>> value = Token(UnsignedFloat()) >>> negfloat = lambda x: -float(x) >>> number = Or(value >> float, ... ~symbol('-') & value >> negfloat) >>> group2, group3 = Delaye…
まんま #!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.move_to [100, 100] pdf.line_to [50, 50] pdf.line_to(50, 50) pdf.stroke pdf.render_file(File.basename($0, ".rb") + ".pdf") move_to などで始点を作ってあげないと表示され…
import org.apache.commons.lang.builder.StandardToStringStyle; public class C2009072400 { public static void main(String[] args) { System.out.println(new StandardToStringStyle().isUseIdentityHashCode()); } } で、 true
まんま >>> from lepl import * >>> letter = Letter() > 'letter' >>> digit = Digit() > 'digit' >>> example = (letter | digit)[:] > Node >>> n = example.parse('abc123d45e')[0] >>> n.letter ['a', 'b', 'c', 'd', 'e'] >>> n.digit ['1', '2', '3',…
まんま #!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.line [100, 100], [200, 250] pdf.line(100, 100, 200, 250) pdf.stroke pdf.render_file(File.basename($0, ".rb") + ".pdf")
import org.apache.commons.lang.builder.StandardToStringStyle; public class C2009072300 { public static void main(String[] args) { System.out.println(new StandardToStringStyle().isUseFieldNames()); } } で、 true
まんま >>> from lepl import * >>> abc = Node('a', 'b', 'c') >>> abc[1] 'b' >>> abc[1:] ['b', 'c'] >>> abc[:-1] ['a', 'b'] >>> fb = Node(('foo', 23), ('bar', 'baz')) >>> fb.foo [23] >>> fb.bar ['baz'] >>> fb = Node(('foo', 23), ('bar', 'baz…
#!/usr/bin/env ruby require "prawn" pdf = Prawn::Document.new pdf.horizontal_rule #pdf.move_to [100, 100] #pdf.horizontal_rule pdf.stroke pdf.render_file(File.basename($0, ".rb") + ".pdf")
import org.apache.commons.lang.builder.StandardToStringStyle; public class C2009072200 { public static void main(String[] args) { System.out.println(new StandardToStringStyle().isUseClassName()); } } で、 true
まんま >>> from lepl import * >>> symbol = Token('[^0-9a-zA-Z \t\r\n]') >>> value = Token(UnsignedFloat()) >>> negfloat = lambda x: -float(x) >>> number = Or(value >> float, ... ~symbol('-') & value >> negfloat) >>> expr = Delayed() >>> ad…