yesworkflow-org / yw-prototypes

Research prototype with tutorial. Start here to learn about and try YesWorkflow.
http://yesworkflow.org/wiki
Other
33 stars 13 forks source link

Infer comment start character from script file name extension. #13

Closed tmcphillips closed 9 years ago

tmcphillips commented 9 years ago

The Java prototype currently assumes that '#' is the first non-whitespace character on any line containing a YW comment. YW should detect the language of the script or program is analyzing and automatically use the correct comment character by default (e.g., '/' for Java). Using the filename extension could be an easy first approach to detecting the programming language. A command-line option should allow the user to provide the comment character and override automatic detection.

Because extract currently ignores all characters between the first comment character and the '@' that begins the YW comment, looking at the first non-whitespace character suffices for now. Because not every line that starts with a '/' is a comment in Java, e.g., we may eventually want to detect a sequence of characters beginning a comment line (although the requirement that the YW comment itself also start with a '@' followed by a recognizable YW keyword may make this unnecessary).

sycao5 commented 9 years ago

I write a method (getCommentCharacter() ) to getCommentCharater based on file extension in DefaultExtractor.java. Then, the method extract() in YesWorkflowCLI.java is changed accordingly. All modification block are annoyed with “@yang”. I attached the files with new changes in this email.

Regards,

Yang

On Jan 2, 2015, at 6:39 PM, Timothy McPhillips notifications@github.com wrote:

The Java prototype currently assumes that '#' is the first non-whitespace character on any line containing a YW comment. YW should detect the language of the script or program is analyzing and automatically use the correct comment character by default (e.g., '/' for Java). Using the filename extension could be an easy first approach to detecting the programming language. A command-line option should allow the user to provide the comment character and override automatic detection.

Because extract currently ignores all characters between the first comment character and the '@' that begins the YW comment, looking at the first non-whitespace character suffices for now. Because not every line that starts with a '/' is a comment in Java, e.g., we may eventually want to detect a sequence of characters beginning a comment line (although the requirement that the YW comment itself also start with a '@' followed by a recognizable YW keyword may make this unnecessary).

— Reply to this email directly or view it on GitHub https://github.com/yesworkflow-org/yw-prototypes/issues/13.

sycao5 commented 9 years ago

Related files are attached. I am sorry to not attached them in the last email. Please review my code and give me comments. Thanks!

Regards,

Yang

On Jan 4, 2015, at 7:58 PM, Susanna Yang Cao sycao5@gmail.com wrote:

I write a method (getCommentCharacter() ) to getCommentCharater based on file extension in DefaultExtractor.java. Then, the method extract() in YesWorkflowCLI.java is changed accordingly. All modification block are annoyed with “@yang”. I attached the files with new changes in this email. Regards, Yang > On Jan 2, 2015, at 6:39 PM, Timothy McPhillips > wrote: > > The Java prototype currently assumes that '#' is the first non-whitespace character on any line containing a YW comment. YW should detect the language of the script or program is analyzing and automatically use the correct comment character by default (e.g., '/' for Java). Using the filename extension could be an easy first approach to detecting the programming language. A command-line option should allow the user to provide the comment character and override automatic detection. > > Because extract currently ignores all characters between the first comment character and the '@' that begins the YW comment, looking at the first non-whitespace character suffices for now. Because not every line that starts with a '/' is a comment in Java, e.g., we may eventually want to detect a sequence of characters beginning a comment line (although the requirement that the YW comment itself also start with a '@' followed by a recognizable YW keyword may make this unnecessary). > > — > Reply to this email directly or view it on GitHub https://github.com/yesworkflow-org/yw-prototypes/issues/13.