comments

Removing nested comments bz lex

半世苍凉 提交于 2019-12-10 14:54:42
问题 How should I do program in lex (or flex) for removing nested comments from text and print just the text which is not in comments? I should probably somehow recognize states when I am in comment and number of starting "tags" of block comment. Lets have rules: 1.block comment /* block comment */ 2. line comment // line comment 3. Comments can be nested. Example 1 show /* comment /* comment */ comment */ show output: show show Example 2 show /* // comment comment */ show output: show show

Are comments always processed before the preprocessor? [duplicate]

感情迁移 提交于 2019-12-10 14:26:29
问题 This question already has answers here : In which step of compilation are comments removed? (2 answers) Closed 2 years ago . /* #define FOO */ #ifdef FOO #define BAR "pirate" #else #define BAR "ninja" #endif int main() { printf(BAR); getchar(); } In this code FOO is not defined (Visual Studio 2008). I assume that comments are processed first, then preprocessor, and then code. Are comments always processed before the preprocessor? Is this part of a standard? 回答1: I assume that comments are

Syntax highlighting of Fortran 77 comments not working in vim

可紊 提交于 2019-12-10 14:05:48
问题 I have a code written in Fortran 77 and I read it with vim. The code is written such that the comments are on lines starting with c , as is standard in Fortran 77. However, vim does not recognize them and therefore use a coloring syntax that makes the code very difficult to read! How can I overcome this? I've seen that there is a post with the same problem. I have read the answers and tried the different solutions that have been suggested: add let fortran_have_tabs=1 to .vimrc add syn match

Is #ifdef MACRO equivalent to a comment

感情迁移 提交于 2019-12-10 13:38:55
问题 Assuming that MACRO is not defined, are these equivalent #ifdef MACRO Not valid C or C++ code #endif /* Not valid C or C++ code */ In GCC 4.7.1, it seems to be equivalent but are there preprocessors that do more? 回答1: It depends on what you mean by "not valid C or C++ code". Text inside a comment does not have to conform to most of the rules of the language. It isn’t even tokenized. This is perfectly valid: /* This comment doesn't contain a valid sequence of preprocessing tokens (because of

Is it possible to declare comment inside of ng-class

别等时光非礼了梦想. 提交于 2019-12-10 13:37:08
问题 I have a question is it possible to declare comment inside of ng-class ng-class="{'test':true,'test1':true, //some comment 'test2':true}" 回答1: It doesn't appear to. You would have needed to use the multiline comment syntax like so: <div ng-class="{'test':true,'test1':true, /* some comment */ 'test2':true}"></div> But that throws an error: Syntax Error: Token '*' is unexpected, expecting [:] at column 29 of the expression [{'test':true,'test1':true, /* some comment */ 'test2':true}] starting

How can I get comments from a YAML file using ruamel.yaml in Python?

£可爱£侵袭症+ 提交于 2019-12-10 13:25:46
问题 I'd like to get the comment strings from a YAML file I loaded using ruamel.yaml . The project documentation lacks an API reference and I can't find a relevant example. What's the right way to access the comments? import ruamel.yaml yaml = """\ %YAML 1.2 --- # C1 a: # C2 # C3 # C4 b: 1 # C5 c: # A comment here will not be parsed properly by ruamel.yaml v0.11.14 - abc # C6 - xyz # C7 # C8 # C9 """ loaded = ruamel.yaml.round_trip_load(yaml) # Now what? 回答1: The library author comments on this in

How to add items enclosed by < > to documentation comments

孤者浪人 提交于 2019-12-10 13:17:37
问题 I am trying to write documentation comments however I have a problem. /// <summary> /// Inserts an element into the System.Collections.Generic.List<T> at the specified /// index. /// </summary> When I reach the <T> Visual studio thinks I am trying to add another tag. what is the correct way to add comments like that (and if I could make them click able in the generated help text that would be a extra bonus) 回答1: C# documentation comments are XML, so change your < and > to < and > . What you

Doxygen — Single Comment Block for Multiple Functions

懵懂的女人 提交于 2019-12-10 12:55:13
问题 Are you able to use a single commenting block to comment multiple functions in doxygen? Below is a simple example that does not work. Can I do something similar to get what I want? file.cpp #include file.h /// @name FunsGroupedInDoxygen ///@{ /** * @brief Documentation for 2 functions * @param aParam A Parameter * @retval 0 will always be returned */ int fun1(int aParam) {return 0;} int fun2(int aParam) {return 0;} ///@} file.h int fun1(int aParam); int fun2(int aParam); Doxygen output:

How to put a comment into HQL (Hibernate Query Language)?

妖精的绣舞 提交于 2019-12-10 12:36:11
问题 Is it possible to put comments into Hibernate Query Language? If so, how? 回答1: AFAIK, HQL does not support comments. 回答2: Make sure your session is configured with: <property name="hibernate.use_sql_comments">true</property> Then do: Query query = ...; query.setComment("Some comment here"); and you will see something like the following in your MySQL log file (if you're using MySQL): 5998 Query /* Some comment here */ select ..... 回答3: If it helps your development, Hibernate Tools (Eclipse)

What is the server side comment tag in scala templates in play framework?

℡╲_俬逩灬. 提交于 2019-12-10 12:32:12
问题 I need to comment my code server side ( not rendered to client) in scala templates in play framework. What is the format of this tag? 回答1: The documentation does not explicitly say, but as the template engine is inspired by ASP.net Razor, I would guess it uses the same syntax, which is @* comment here *@ Note the end comment is done with a closing @ symbol. 回答2: This works: @{ /* Comment */ } But I was hoping something even better (requiring less typing) is out there. 回答3: These two are