Code Completion
ã»http://nemerle.org/Code_Completion
æè¿ã®ç®çæ©è½ãã½ã¼ã¹ã³ã¼ããé£ã¹ã¦TypeTreeãä½æãã¾ããèªåã§Parserã¨ãããããå¿
è¦ãç¡ããªãã®ã§ããã¼ã«éçºè
ã«ã¯æå ±ãããä¸è¨ãªã³ã¯ãèªãã¨é°å²æ°ãæ´ããã¨æãã¾ãããã ãç¾å¨éçºä¸ã®çºããµã³ãã«ã³ã¼ãã¯å¤ããªã£ã¦ãã¾ã£ã¦ããã®ã§ãç°¡åãªä¾ãç´¹ä»ãã¾ãã
hello.n (æ¸ãããã®ã½ã¼ã¹)
class Calc { Add (x : int, y : int) : int { x + y; } Subtract (x : int, y : int) : int { // x - y; // } }
ä¾ãã°ããããªæ¸ãããã®ã½ã¼ã¹ããã£ãã¨ãã¾ããã³ã¤ããCode Completion Engineã«é£ããã¦ã¿ã¾ãã
app.h (ã¨ã³ã¸ã³ã®å¼ã³åºã)
using System.IO; using System.Console; using Nemerle.Compiler; using Nemerle.Completion; def file = "hello.n"; def engine = Engine (); def reader = StreamReader (file); engine.Sources.Add (file, reader.ReadToEnd ()); def tree = engine.GetTypeTree (); foreach (t in tree.Types) { WriteLine (t.Name); foreach (m in t.Methods) { WriteLine ($"$(t.Name)::$(m.Name)"); } }
ã§ã次ã®ããã«ã³ã³ãã¤ã«ããå®è¡ã
$ ncc -r:Nemerle.Compiler -o app.exe app.n $ mono app.exe
ããã¨ããã®ããã«ã³ã³ãã¤ã«ã®éããªãã½ã¼ã¹ã§ãTypeTreeãä½æããã¾ãã
Calc Calc::Subtract Calc::Add Calc::.ctor
ã½ã¼ã¹ãå®å
¨ã§ã¯ãªãSubtractãã¡ã½ããã¨ãã¦èªèããã¦ãã¾ããã
(追è¨) ããã¯ã©ã¹ã®éãæ¬å¼§ããããããä¸å®å
¨ãªã®ã¯ã¯ã©ã¹ã§ããã(^^;