Search Results

Search found 11993 results on 480 pages for 'define syntax'.

Page 1/480 | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • VIM does not detect syntax of .ssh/config

    - by Erik
    On a plain Ubuntu installation (12.04 in my case) when I have no ~/.vimrc VIM does not detect syntax of .ssh/config. Syntax highlighting works, but it does not set the correct filetype. vi ~/.ssh/config :set syn? >syntax=conf When I do: set syn=sshconfig Then the syntax highlighting is as it should be. Why isn't the filetype automatically identified? And how can it be set automatically?

    Read the article

  • If you had to reinvent a new syntax for regular expressions, what would it look like?

    - by Timwi
    Regular expressions as they are today are pretty much as concise and compact as they can be. Consequently, they are often criticised for being unreadable and hard to debug. If you had to reinvent a new syntax for regular expressions, what would it look like? Do you prefer the concise syntax they already have (or a different but similarly concise syntax)? If so, please justify why you think regular expressions deserve to be this concise, but your favourite programming language doesn’t (unless it’s Perl). Or do you think regular expressions should have a slightly more spaced-out syntax and look a bit more like operators and syntax elements normally do in programming languages? If so, provide examples of what you think the syntax should look like, and justify why it is better than the current syntax. Or do you think there shouldn’t even be a special syntax for regular expressions, and instead they should be constructed from syntax elements already present in the programming language? If so, give examples of a syntax that might be used to construct such regular expressions.

    Read the article

  • Developing configuration syntax - best practise/rules/methods?

    - by Isaac
    I am currently developing a small application, which checks if provided data meets certain requirements. The requirements are actually a long list, and might be changing, so I defined a syntax which allows me to state all of the requirements briefly and in a seperate file. Now the overall requirements for the application have changed, and I need to change my configuration syntax. Which leeds me to wonder if there is methodoloy or best practise for developing such syntaxes. Currently what I do is I think about the requirements and come up with an initial syntax, start configuring the first few items and see how it works. If I come upon something that does not work well or not at all with the current syntax, I change the syntax, if possible in a backward compatible way. This somehow works for me, but it feels a bit like fishing in troubled water. Also I feel it does not nessessarly lead to the most concise and easy to understand/use syntax. So I was wondering what other people do, especially if there is a better approach to this.

    Read the article

  • Xcode newb -- #include can't find my file

    - by morgancodes
    I'm trying to get a third party audio library (STK) working inside Xcode. Along with the standard .h files, many of the implementation files include a file called SKINI.msg. SKINI.msg is in the same directory as all of the header files. The header files are getting included fine, but the compiler complains that it can't find SKINI.msg. What do I need to do to get Xcode to happily include SKINI.msg? Edit: Here's the contents of SKINI.msg: /*********************************************************/ /* Definition of SKINI Message Types and Special Symbols Synthesis toolKit Instrument Network Interface These symbols should have the form: \c __SK_<name>_ where <name> is the string used in the SKINI stream. by Perry R. Cook, 1995 - 2010. */ /*********************************************************/ namespace stk { #define NOPE -32767 #define YEP 1 #define SK_DBL -32766 #define SK_INT -32765 #define SK_STR -32764 #define __SK_Exit_ 999 /***** MIDI COMPATIBLE MESSAGES *****/ /*** (Status bytes for channel=0) ***/ #define __SK_NoteOff_ 128 #define __SK_NoteOn_ 144 #define __SK_PolyPressure_ 160 #define __SK_ControlChange_ 176 #define __SK_ProgramChange_ 192 #define __SK_AfterTouch_ 208 #define __SK_ChannelPressure_ __SK_AfterTouch_ #define __SK_PitchWheel_ 224 #define __SK_PitchBend_ __SK_PitchWheel_ #define __SK_PitchChange_ 49 #define __SK_Clock_ 248 #define __SK_SongStart_ 250 #define __SK_Continue_ 251 #define __SK_SongStop_ 252 #define __SK_ActiveSensing_ 254 #define __SK_SystemReset_ 255 #define __SK_Volume_ 7 #define __SK_ModWheel_ 1 #define __SK_Modulation_ __SK_ModWheel_ #define __SK_Breath_ 2 #define __SK_FootControl_ 4 #define __SK_Portamento_ 65 #define __SK_Balance_ 8 #define __SK_Pan_ 10 #define __SK_Sustain_ 64 #define __SK_Damper_ __SK_Sustain_ #define __SK_Expression_ 11 #define __SK_AfterTouch_Cont_ 128 #define __SK_ModFrequency_ __SK_Expression_ #define __SK_ProphesyRibbon_ 16 #define __SK_ProphesyWheelUp_ 2 #define __SK_ProphesyWheelDown_ 3 #define __SK_ProphesyPedal_ 18 #define __SK_ProphesyKnob1_ 21 #define __SK_ProphesyKnob2_ 22 /*** Instrument Family Specific ***/ #define __SK_NoiseLevel_ __SK_FootControl_ #define __SK_PickPosition_ __SK_FootControl_ #define __SK_StringDamping_ __SK_Expression_ #define __SK_StringDetune_ __SK_ModWheel_ #define __SK_BodySize_ __SK_Breath_ #define __SK_BowPressure_ __SK_Breath_ #define __SK_BowPosition_ __SK_PickPosition_ #define __SK_BowBeta_ __SK_BowPosition_ #define __SK_ReedStiffness_ __SK_Breath_ #define __SK_ReedRestPos_ __SK_FootControl_ #define __SK_FluteEmbouchure_ __SK_Breath_ #define __SK_JetDelay_ __SK_FluteEmbouchure_ #define __SK_LipTension_ __SK_Breath_ #define __SK_SlideLength_ __SK_FootControl_ #define __SK_StrikePosition_ __SK_PickPosition_ #define __SK_StickHardness_ __SK_Breath_ #define __SK_TrillDepth_ 1051 #define __SK_TrillSpeed_ 1052 #define __SK_StrumSpeed_ __SK_TrillSpeed_ #define __SK_RollSpeed_ __SK_TrillSpeed_ #define __SK_FilterQ_ __SK_Breath_ #define __SK_FilterFreq_ 1062 #define __SK_FilterSweepRate_ __SK_FootControl_ #define __SK_ShakerInst_ 1071 #define __SK_ShakerEnergy_ __SK_Breath_ #define __SK_ShakerDamping_ __SK_ModFrequency_ #define __SK_ShakerNumObjects_ __SK_FootControl_ #define __SK_Strumming_ 1090 #define __SK_NotStrumming_ 1091 #define __SK_Trilling_ 1092 #define __SK_NotTrilling_ 1093 #define __SK_Rolling_ __SK_Strumming_ #define __SK_NotRolling_ __SK_NotStrumming_ #define __SK_PlayerSkill_ 2001 #define __SK_Chord_ 2002 #define __SK_ChordOff_ 2003 #define __SK_SINGER_FilePath_ 3000 #define __SK_SINGER_Frequency_ 3001 #define __SK_SINGER_NoteName_ 3002 #define __SK_SINGER_Shape_ 3003 #define __SK_SINGER_Glot_ 3004 #define __SK_SINGER_VoicedUnVoiced_ 3005 #define __SK_SINGER_Synthesize_ 3006 #define __SK_SINGER_Silence_ 3007 #define __SK_SINGER_VibratoAmt_ __SK_ModWheel_ #define __SK_SINGER_RndVibAmt_ 3008 #define __SK_SINGER_VibFreq_ __SK_Expression_ } // stk namespace And here's what the compiler said: CompileC build/StkCompile.build/Debug-iphonesimulator/StkCompile.build/Objects-normal/i386/BandedWG.o "../../../Data/study/iPhone class/stk-4.4.2/src/BandedWG.cpp" normal i386 c++ com.apple.compilers.gcc.4_2 cd /Users/morganpackard/Desktop/trashme/StkCompile setenv LANG en_US.US-ASCII setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin" /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 -x c++ -arch i386 -fmessage-length=0 -pipe -Wno-trigraphs -fpascal-strings -fasm-blocks -O0 -Wreturn-type -Wunused-variable -D__IPHONE_OS_VERSION_MIN_REQUIRED=30000 -isysroot /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator3.1.2.sdk -fvisibility=hidden -fvisibility-inlines-hidden -mmacosx-version-min=10.5 -gdwarf-2 -iquote /Users/morganpackard/Desktop/trashme/StkCompile/build/StkCompile.build/Debug-iphonesimulator/StkCompile.build/StkCompile-generated-files.hmap -I/Users/morganpackard/Desktop/trashme/StkCompile/build/StkCompile.build/Debug-iphonesimulator/StkCompile.build/StkCompile-own-target-headers.hmap -I/Users/morganpackard/Desktop/trashme/StkCompile/build/StkCompile.build/Debug-iphonesimulator/StkCompile.build/StkCompile-all-target-headers.hmap -iquote /Users/morganpackard/Desktop/trashme/StkCompile/build/StkCompile.build/Debug-iphonesimulator/StkCompile.build/StkCompile-project-headers.hmap -F/Users/morganpackard/Desktop/trashme/StkCompile/build/Debug-iphonesimulator -I/Users/morganpackard/Desktop/trashme/StkCompile/build/Debug-iphonesimulator/include -I/Users/morganpackard/Desktop/trashme/StkCompile/build/StkCompile.build/Debug-iphonesimulator/StkCompile.build/DerivedSources/i386 -I/Users/morganpackard/Desktop/trashme/StkCompile/build/StkCompile.build/Debug-iphonesimulator/StkCompile.build/DerivedSources -include /var/folders/dx/dxSUSyOJFv0MBEh9qC1oJ++++TI/-Caches-/com.apple.Xcode.501/SharedPrecompiledHeaders/StkCompile_Prefix-bopqzvwpuyqltrdumgtjtfrjvtzb/StkCompile_Prefix.pch -c "/Users/morganpackard/Desktop/trashme/StkCompile/../../../Data/study/iPhone class/stk-4.4.2/src/BandedWG.cpp" -o /Users/morganpackard/Desktop/trashme/StkCompile/build/StkCompile.build/Debug-iphonesimulator/StkCompile.build/Objects-normal/i386/BandedWG.o /Users/morganpackard/Desktop/trashme/StkCompile/../../../Data/study/iPhone class/stk-4.4.2/src/BandedWG.cpp:33:21: error: SKINI.msg: No such file or directory /Users/morganpackard/Desktop/trashme/StkCompile/../../../Data/study/iPhone class/stk-4.4.2/src/BandedWG.cpp: In member function 'virtual void stk::BandedWG::controlChange(int, stk::StkFloat)': /Users/morganpackard/Desktop/trashme/StkCompile/../../../Data/study/iPhone class/stk-4.4.2/src/BandedWG.cpp:326: error: '__SK_BowPressure_' was not declared in this scope /Users/morganpackard/Desktop/trashme/StkCompile/../../../Data/study/iPhone class/stk-4.4.2/src/BandedWG.cpp:342: error: '__SK_AfterTouch_Cont_' was not declared in this scope /Users/morganpackard/Desktop/trashme/StkCompile/../../../Data/study/iPhone class/stk-4.4.2/src/BandedWG.cpp:349: error: '__SK_ModWheel_' was not declared in this scope /Users/morganpackard/Desktop/trashme/StkCompile/../../../Data/study/iPhone class/stk-4.4.2/src/BandedWG.cpp:357: error: '__SK_ModFrequency_' was not declared in this scope /Users/morganpackard/Desktop/trashme/StkCompile/../../../Data/study/iPhone class/stk-4.4.2/src/BandedWG.cpp:359: error: '__SK_Sustain_' was not declared in this scope /Users/morganpackard/Desktop/trashme/StkCompile/../../../Data/study/iPhone class/stk-4.4.2/src/BandedWG.cpp:363: error: '__SK_Portamento_' was not declared in this scope /Users/morganpackard/Desktop/trashme/StkCompile/../../../Data/study/iPhone class/stk-4.4.2/src/BandedWG.cpp:367: error: '__SK_ProphesyRibbon_' was not declared in this scope

    Read the article

  • How are vector patterns used in syntax-rules?

    - by Jay
    Hi, I have been writing Common Lisp macros, so Scheme's R5Rs macros are a bit unnatural to me. I think I got the idea, except that I don't understand how one would use vector patterns in syntax-rules: (define-syntax mac (syntax-rules () ((mac #(a b c d)) (let () (display a) (newline) (display d) (newline))))) (expand '(mac #(1 2 3 4))) ;; Chicken's expand-full extension shows macroexpansion => (let746 () (display747 1) (newline748) (display747 4) (newline748)) I don't see how I'd use a macro that requires its arguments to be written as a vector: (mac #(1 2 3 4)) => 1 4 Is there some kind of technique that uses those patterns? Thank you!

    Read the article

  • Initializing PHP class property declarations with simple expressions yields syntax error

    - by user171929
    According to the PHP docs, one can initialize properties in classes with the following restriction: "This declaration may include an initialization, but this initialization must be a constant value--that is, it must be able to be evaluated at compile time and must not depend on run-time information in order to be evaluated." I'm trying to initialize an array and having some issues. While this works fine: public $var = array( 1 => 4, 2 => 5, ); This creates a syntax error: public $var = array( 1 => 4, 2 => (4+1), ); Even this isn't accepted: public $var = 4+1; which suggests it's not a limitation of the array() language construct. Now, the last time I checked, "4+1" equated to a constant value that not only should be accepted, but should in fact be optimized away. In any case, it's certainly able to be evaluated at compile-time. So what's going on here? Is the limitation really along the lines of "cannot be any calculated expression at all", versus any expression "able to be evaluated at compile time"? The use of "evaluated" in the doc's language suggests that simple calculations are permitted, but alas.... If this is a bug in PHP, does anyone have a bug ID? I tried to find one but didn't have any luck.

    Read the article

  • Does syntax really matter in a programming language?

    - by Saif al Harthi
    One of my professors says "the Syntax is the UI of a programming language", languages like ruby have great readability & its growing but we see alot of programmers productive with C\C++, so as programmers does it really matter that the syntax should be acceptable? I would love to know your opinion on that. Disclaimer: I'm not trying to start an argument I thought this is a good topic of discussion. Update : this turns out to be a good topic i'm glad you are all participating it , there will be more good questions to come

    Read the article

  • Syntax of passing lambda

    - by Astara
    Right now, I'm working on refactoring a program that calls its parts by polling to a more event-driven structure. I've created sched and task classes with the sced to become a base class of the current main loop. The tasks will be created for each meter so they can be called off of that instead of polling. Each of the events main calls are a type of meter that gather info and display it. When the program is coming up, all enabled meters get 'constructed' by a main-sub. In that sub, I want to store off the "this" pointer associated with the meter, as well as the common name for the "action routine. void MeterMaker::Meter_n_Task (Meter * newmeter,) { push(newmeter); // handle non-timed draw events Task t = new Task(now() + 0.5L); t.period={0,1U}; t.work_meter = newmeter; t.work = [&newmeter](){newmeter.checkevent();};<<--attempt at lambda t.flags = T_Repeat; t.enable_task(); _xos->sched_insert(t); } A sample call to it: Meter_n_Task(new CPUMeter(_xos, "CPU ")); 've made the scheduler a base class of the main routine (that handles the loop), and I've tried serveral variations to get the task class to be a base of the meter class, but keep running into roadblocks. It's alot like "whack-a-mole" -- pound in something to fix something one place, and then a new probl pops out elsewhere. Part of the problem, is that the sched.h file that is trying to hold the Task Q, includes the Task header file. The task file Wants to refer to the most "base", Meter class. The meter class pulls in the main class of the parent as it passes a copy of the parent to the children so they can access the draw routines in the parent. Two references in the task file are for the 'this' pointer of the meter and the meter's update sub (to be called via this). void *this_data= NULL; void (*this_func)() = NULL; Note -- I didn't really want to store these in the class, as I wanted to use a lamdba in that meter&task routine above to store a routine+context to be used to call the meter's action routine. Couldn't figure out the syntax. But am running into other syntax problems trying to store the pointers...such as g++: COMPILE lsched.cc In file included from meter.h:13:0, from ltask.h:17, from lsched.h:13, from lsched.cc:13: xosview.h:30:47: error: expected class-name before ‘{’ token class XOSView : public XWin, public Scheduler { Like above where it asks for a class, where the classname "Scheduler" is. !?!? Huh? That IS a class name. I keep going in circles with things that don't make sense... Ideally I'd get the lamba to work right in the Meter_n_Task routine at the top. I wanted to only store 1 pointer in the 'Task' class that was a pointer to my lambda that would have already captured the "this" value ... but couldn't get that syntax to work at all when I tried to start it into a var in the 'Task' class. This project, FWIW, is my teething project on the new C++... (of course it's simple!.. ;-))... I've made quite a bit of progress in other areas in the code, but this lambda syntax has me stumped...its at times like thse that I appreciate the ease of this type of operation in perl. Sigh. Not sure the best way to ask for help here, as this isn't a simple question. But thought I'd try!... ;-) Too bad I can't attach files to this Q.

    Read the article

  • Syntax of passing lambda causing hair loss (pulling out)

    - by Astara
    Right now, I'm working on refactoring a program that calls its parts by polling to a more event-driven structure. I've created sched and task classes with the sced to become a base class of the current main loop. The tasks will be created for each meter so they can be called off of that instead of polling. Each of the events main calls are a type of meter that gather info and display it. When the program is coming up, all enabled meters get 'constructed' by a main-sub. In that sub, I want to store off the "this" pointer associated with the meter, as well as the common name for the "action routine. void MeterMaker::Meter_n_Task (Meter * newmeter,) { push(newmeter); // handle non-timed draw events Task t = new Task(now() + 0.5L); t.period={0,1U}; t.work_meter = newmeter; t.work = [&newmeter](){newmeter.checkevent();};<<--attempt at lambda t.flags = T_Repeat; t.enable_task(); _xos->sched_insert(t); } A sample call to it: Meter_n_Task(new CPUMeter(_xos, "CPU ")); 've made the scheduler a base class of the main routine (that handles the loop), and I've tried serveral variations to get the task class to be a base of the meter class, but keep running into roadblocks. It's alot like "whack-a-mole" -- pound in something to fix something one place, and then a new probl pops out elsewhere. Part of the problem, is that the sched.h file that is trying to hold the Task Q, includes the Task header file. The task file Wants to refer to the most "base", Meter class. The meter class pulls in the main class of the parent as it passes a copy of the parent to the children so they can access the draw routines in the parent. Two references in the task file are for the 'this' pointer of the meter and the meter's update sub (to be called via this). void *this_data= NULL; void (*this_func)() = NULL; Note -- I didn't really want to store these in the class, as I wanted to use a lamdba in that meter&task routine above to store a routine+context to be used to call the meter's action routine. Couldn't figure out the syntax. But am running into other syntax problems trying to store the pointers...such as g++: COMPILE lsched.cc In file included from meter.h:13:0, from ltask.h:17, from lsched.h:13, from lsched.cc:13: xosview.h:30:47: error: expected class-name before ‘{’ token class XOSView : public XWin, public Scheduler { Like above where it asks for a class, where the classname "Scheduler" is. !?!? Huh? That IS a class name. I keep going in circles with things that don't make sense... Ideally I'd get the lamba to work right in the Meter_n_Task routine at the top. I wanted to only store 1 pointer in the 'Task' class that was a pointer to my lambda that would have already captured the "this" value ... but couldn't get that syntax to work at all when I tried to start it into a var in the 'Task' class. This project, FWIW, is my teething project on the new C++... (of course it's simple!.. ;-))... I've made quite a bit of progress in other areas in the code, but this lambda syntax has me stumped...its at times like thse that I appreciate the ease of this type of operation in perl. Sigh. Not sure the best way to ask for help here, as this isn't a simple question. But thought I'd try!... ;-) Too bad I can't attach files to this Q.

    Read the article

  • Does syntax really matter in a programming language?

    - by Saif al Harthi
    One of my professors says "the syntax is the UI of a programming language", languages like Ruby have great readability and it's growing, but we see a lot of programmers productive with C\C++, so as programmers does it really matter that the syntax should be acceptable? I would love to know your opinion on that. Disclaimer: I'm not trying to start an argument. I thought this is a good topic of discussion. Update: This turns out to be a good topic. I'm glad you are all participating in it.

    Read the article

  • Variable declaration versus assignment syntax

    - by rwallace
    Working on a statically typed language with type inference and streamlined syntax, and need to make final decision about syntax for variable declaration versus assignment. Specifically I'm trying to choose between: // Option 1. Create new local variable with :=, assign with = foo := 1 foo = 2 // Option 2. Create new local variable with =, assign with := foo = 1 foo := 2 Creating functions will use = regardless: // Indentation delimits blocks square x = x * x And assignment to compound objects will do likewise: sky.color = blue a[i] = 0 Which of options 1 or 2 would people find most convenient/least surprising/otherwise best?

    Read the article

  • C syntax or binary optimized syntax?

    - by Dpp
    Let's take an simple example of two lines supposedly doing the same thing: if (value = 96 || value < 0) ... or if (value & ~ 95) ... Say 'If's are costly in a loop of thousands of iterations, is it better to keep with the traditional C syntax or better to find a binary optimized one if possible?

    Read the article

  • Python invalid syntax with "with" statement

    - by mrlanrat
    Hello all, I am working on writing a simple python application for linux (maemo). However I am getting SyntaxError: invalid syntax on line 23: with open(file,'w') as fileh: The code can be seen here: http://pastebin.com/MPxfrsAp I can not figure out what is wrong with my code, I am new to python and the "with" statement. So, what is causing this code to error, and how can I fix it? Is it something wrong with the "with" statement? Thanks!

    Read the article

  • What do you think of this generator syntax?

    - by ChaosPandion
    I've been working on an ECMAScript dialect for quite some time now and have reached a point where I am comfortable adding new language features. I would love to hear some thoughts and suggestions on the syntax. Example generator { yield 1; yield 2; yield 3; if (true) { yield break; } yield continue generator { yield 4; yield 5; yield 6; }; } Syntax GeneratorExpression:     generator  {  GeneratorBody  } GeneratorBody:     GeneratorStatementsopt GeneratorStatements:     StatementListopt GeneratorStatement GeneratorStatementsopt GeneratorStatement:     YieldStatement     YieldBreakStatement     YieldContinueStatement YieldStatement:     yield  Expression  ; YieldBreakStatement:     yield  break  ; YieldContinueStatement:     yield  continue  Expression  ; Semantics The YieldBreakStatement allows you to end iteration early. This helps avoid deeply indented code. You'll be able to write something like this: generator { yield something1(); if (condition1 && condition2) yield break; yield something2(); if (condition3 && condition4) yield break; yield something3(); } instead of: generator { yield something1(); if (!condition1 && !condition2) { yield something2(); if (!condition3 && !condition4) { yield something3(); } } } The YieldContinueStatement allows you to combine generators: function generateNumbers(start) { return generator { yield 1 + start; yield 2 + start; yield 3 + start; if (start < 100) { yield continue generateNumbers(start + 1); } }; }

    Read the article

  • What do you think of this iterator syntax?

    - by ChaosPandion
    I've been working on an ECMAScript dialect for quite some time now and have reached a point where I am comfortable adding new language features. I would love to hear some thoughts and suggestions on the syntax. Example iterator Numbers { yield 1; yield 2; yield 3; if (true) { yield break; } yield continue iterator { yield 4; yield 5; yield 6; }; } Syntax IteratorDeclaration:     iterator  Identifier  {  IteratorBody  } IteratorExpression:     iterator  Identifieropt  {  IteratorBody  } IteratorBody:     IteratorStatementsopt IteratorStatements:     IteratorStatement IteratorStatementsopt IteratorStatement:     Statement but not one of BreakStatement ContinueStatement ReturnStatement     YieldStatement     YieldBreakStatement     YieldContinueStatement YieldStatement:     yield  Expression  ; YieldBreakStatement:     yield  break  ; YieldContinueStatement:     yield  continue  Expression  ;

    Read the article

  • Syntax logic suggestions

    - by Anna
    This syntax will be used inside HTML attributes. Here are a few examples of what I have so far: <input name="a" conditions="!b, c" /> <input name="b" /> <input name="c" /> This will make input "a" do something if b is not checked and c is checked (b and c are assumed to be checkboxes if they don't have a :value defined) <input name="a" conditions="!b:foo|bar, c:foo" /> <input name="b" /> <input name="c" /> This will make input "a" do something if bdoesn't have foo or bar values, and if c has the foo value. <input name="a" conditions="!b:EMPTY" /> <input name="b" /> Makes input "a" do something if b has a value assigned. So, essentially , acts as logical AND, : as equals (=), ! as NOT, and | as OR. The | (OR) is only needed between values (at least I think so), and AND is not needed between values for obvious reasons :) EMPTY means empty value, like <input value="" /> Do you have any suggestions on improving this syntax, like making it more human friendly? For example I think the "EMPTY" keyword is not really appropriate and should be replaced with a character, but I don't know which one to choose.

    Read the article

  • a macro question for c language (#define)

    - by Daniel
    I am reading source code of hoard memory allocator, and in the file of gnuwrapper.cpp, there are the following code #define CUSTOM_MALLOC(x) CUSTOM_PREFIX(malloc)(x) What's the meaning of CUSTOM_PREFIX(malloc)(x)? is CUSTOM_PREFIX a function? But as a function it didn't defined anywhere. If it's variable, then how can we use variable like var(malloc)(x)? more code: #ifndef __GNUC__ #error "This file requires the GNU compiler." #endif #include <string.h> #include <stdlib.h> #include <stdio.h> #include <malloc.h> #ifndef CUSTOM_PREFIX ==> here looks like it's a variable, so if it doesn't define, then define here. #define CUSTOM_PREFIX #endif #define CUSTOM_MALLOC(x) CUSTOM_PREFIX(malloc)(x) ===> what's the meaning of this? #define CUSTOM_FREE(x) CUSTOM_PREFIX(free)(x) #define CUSTOM_REALLOC(x,y) CUSTOM_PREFIX(realloc)(x,y) #define CUSTOM_MEMALIGN(x,y) CUSTOM_PREFIX(memalign)(x,y)

    Read the article

  • PHP syntax error “unexpected $end”

    - by Jacksta
    I have 3 files 1) show_createtable.html 2) do_showfielddef.php 3) do_showtble.php 1) First file is for creating a new table for a data base, it is a fom with 2 inputs, Table Name and Number of Fields. THIS WORKS FINE! <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> </head> <body> <h1>Step 1: Name and Number</h1> <form method="post" action="do_showfielddef.php" /> <p><strong>Table Name:</strong><br /> <input type="text" name="table_name" size="30" /></p> <p><strong>Number of fields:</strong><br /> <input type="text" name="num_fields" size="30" /></p> <p><input type="submit" name="submit" value="go to step2" /></p> </form> </body> </html> 2) this script validates fields and createa another form to enter all the table rows. This for also WORKS FINE! <?php //validate important input if ((!$_POST[table_name]) || (!$_POST[num_fields])) { header( "location: show_createtable.html"); exit; } //begin creating form for display $form_block = " <form action=\"do_createtable.php\" method=\"post\"> <input name=\"table_name\" type=\"hidden\" value=\"$_POST[table_name]\"> <table cellspacing=\"5\" cellpadding=\"5\"> <tr> <th>Field Name</th><th>Field Type</th><th>Table Length</th> </tr>"; //count from 0 until you reach the number fo fields for ($i = 0; $i <$_POST[num_fields]; $i++) { $form_block .=" <tr> <td align=center><input type=\"texr\" name=\"field name[]\" size=\"30\"></td> <td align=center> <select name=\"field_type[]\"> <option value=\"char\">char</option> <option value=\"date\">date</option> <option value=\"float\">float</option> <option value=\"int\">int</option> <option value=\"text\">text</option> <option value=\"varchar\">varchar</option> </select> </td> <td align=center><input type=\"text\" name=\"field_length[]\" size=\"5\"> </td> </tr>"; } //finish up the form $form_block .= " <tr> <td align=center colspan=3><input type =\"submit\" value=\"create table\"> </td> </tr> </table> </form>"; ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Create a database table: Step 2</title> </head> <body> <h1>defnie fields for <? echo "$_POST[table_name]"; ?> </h1> <? echo "$form_block"; ?> </body> </html> Problem is here 3) this form creates the tables and enteres them into the database. I am getting an error on line 37 "Parse error: syntax error, unexpected $end in /home/admin/domains/domaina.com.au/public_html/do_createtable.php on line 37" <? $db_name = "testDB"; $connection = @mysql_connect("localhost", "admin_user", "pass") or die(mysql_error()); $db = @mysql_select_db($db_name, $connection) or die(mysql_error()); $sql = "CREATE TABLE $_POST[table_name]("; for ($i = 0; $i < count($_POST[field_name]); $i++) { $sql .= $_POST[field_name][$i]." ".$_POST[field_type][$i]; if ($_POST[field_length][$i] !="") { $sql .=" (".$_POST[field_length][$i]."),"; } else { $sql .=","; } $sql = substr($sql, 0, -1); $sql .= ")"; $result = mysql_query($sql, $connection) or die(mysql_error()); if ($result) { $msg = "<p>" .$_POST[table_name]." has been created!</p>"; ?> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Create A Database Table: Step 3</title> </head> <body> <h1>Adding table to <? echo "$db_name"; ?>...</h1> <? echo "$msg"; ?> </body> </html>

    Read the article

  • What is the difference between an Abstract Syntax Tree and a Concrete Syntax Tree?

    - by Jason Baker
    I've been reading a bit about how interpreters/compilers work, and one area where I'm getting confused is the difference between an AST and a CST. My understanding is that the parser makes a CST, hands it to the semantic analyzer which turns it into an AST. However, my understanding is that the semantic analyzer simply ensures that rules are followed. I don't really understand why it would actually make any changes to make it abstract rather than concrete. Is there something that I'm missing about the semantic analyzer, or is the difference between an AST and CST somewhat artificial?

    Read the article

  • Syntax Recognition for XML-Based Languages in Oracle JDeveloper

    - by Ramkumar Menon
      @Thanks Jeffrey Stephenson If you are looking at using any one of the new XML Based languages, lets say a docbook xml, or xproc, or what not, you can make use of JDeveloper's syntax highlighting and completion insight feature to ease out those extra keystrokes. All you need is a URL/local copy of the XML Schema for the language. Once you have, you can register it via Tools --> Preferences --> XML Schemas.   Remember to provide a new extension name [Using a default .xml extension did not work for me.] I provided my own extension .dbk for my docbook files. Once you save these settings, you can create new files that conform to the schema, and you get validation/completion insight/prompting for free.      

    Read the article

  • Bash script throws, "syntax error near unexpected token `}'" when ran

    - by Tab00
    I am trying to write a script to monitor some battery statuses on a laptop running as a server. To accomplish this, I have already started to write this code: #! /bin/bash # A script to monitor battery statuses and send out email notifications #take care of looping the script for (( ; ; )) do #First, we check to see if the battery is present... if(cat /proc/acpi/battery/BAT0/state | grep 'present: *' == present: yes) { #Code to execute if battery IS present #No script needed for our application #you may add scripts to run } else { #if the battery IS NOT present, run this code sendemail -f [email protected] -t 214*******@txt.att.net -u NTA TV Alert -m "The battery from the computer is either missing, or removed. Please check ASAP." -s smtp.gmail.com -o tls=yes -xu [email protected] -xp *********** } #Second, we check into the current state of the battery if(cat /proc/acpi/battery/BAT0/state | grep 'charging state: *' == 'charging state: charging') { #Code to execute if battery is charging sendemail -f [email protected] -t 214*******@txt.att.net -u NTA TV Alert -m "The battery from the computer is charging. This MIGHT mean that something just happened" -s smtp.gmail.com -o tls=yes -xu [email protected] -xp *********** } #If it isn't charging, is it discharging? else if(cat /proc/acpi/battery/BAT0/state | grep 'charging state: *' == 'charging state: discharging') { #Code to run if the battery is discharging sendemail -f [email protected] -t 214*******@txt.att.net -u NTA TV Alert -m "The battery from the computer is discharging. This shouldn't be happening. Please check ASAP." -s smtp.gmail.com -o tls=yes -xu [email protected] -xp *********** } #If it isn't charging or discharging, is it charged? else if(cat /proc/acpi/battery/BAT0/state | grep 'charging state: *' == 'charging state: charged') { #Code to run if battery is charged } done I'm pretty sure that most of the other stuff works correctly, but I haven't been able to try it because it will not run. whenever I try and run the script, this is the error that I get: ./BatMon.sh: line 15: syntax error near unexpected token `}' ./BatMon.sh: ` }' is the error something super simple like a forgotten semicolon? Thanks -Tab00

    Read the article

  • Building a common syntax and scoping framework.

    - by Ben DeMott
    Hello fellow programmers, I was discussing a project the other day with a colleague of mine and I was curious to see what others had to say or if such a thing already existed. Background There are many programming languages. There are many IDE's and source editors that highlight and edit source code. Following perfectly and exactly the rules of a language to present auto-complete options and understand scopes in the code is rather complex. This task is complex enough that most IDE's implement different source-editors as plugins that often re-implement the same features over and over but in a different way (netbeans). From what I can tell most IDE's and source editors re-implement parsers that use regular expressions, or some meta-syntax Naur Form to describe the languages grammer generically. These parsers are implemented over and over and over again. Question Has anyone attempted to unify or describe a set of features through an API and have a consistent interface to parsing various programming languages and dialects. I'm not describing an IDE - but a consistent API for any program to use to parse and obtain meta-information from the source code. I realize various programming languages offer many different features which are difficult to 'abstract' into a set of features, but I feel this would be a worthwhile venture. It seems to me that this could possibly allow the authors of interpreters to help maintain a central grammer intepreter for their language. the Python foundation could maintain the Python grammer api, ANSI the C grammer api, Oracle the Java grammer API, etc Example usage If this was API existed code documentation generators could theoretically work across all dialects and languages to some level. It wouldn't matter if your project used 5 different languages a single application could document all of them and the comments and doc-tags within. Has anyone attempted this comprehensively?

    Read the article

  • Languages like Tcl that have configurable syntax?

    - by boost
    I'm looking for a language that will let me do what I could do with Clipper years ago, and which I can do with Tcl, namely add functionality in a way other than just adding functions. For example in Clipper/(x)Harbour there are commands #command, #translate, #xcommand and #xtranslate that allow things like this: #xcommand REPEAT; => DO WHILE .T. #xcommand UNTIL <cond>; => IF (<cond>); ;EXIT; ;ENDIF; ;ENDDO LOCAL n := 1 REPEAT n := n + 1 UNTIL n > 100 Similarly, in Tcl I'm doing proc process_range {_for_ project _from_ dat1 _to_ dat2 _by_ slice} { set fromDate [clock scan $dat1] set toDate [clock scan $dat2] if {$slice eq "day"} then {set incrementor [expr 24 * 60]} if {$slice eq "hour"} then {set incrementor 60} set method DateRange puts "Scanning from [clock format $fromDate -format "%c"] to [clock format $toDate -format "%c"] by $slice" for {set dateCursor $fromDate} {$dateCursor <= $toDate} {set dateCursor [clock add $dateCursor $incrementor minutes]} { # ... } } process_range for "client" from "2013-10-18 00:00" to "2013-10-20 23:59" by day Are there any other languages that permit this kind of, almost COBOL-esque, syntax modification? If you're wondering why I'm asking, it's for setting up stuff so that others with a not-as-geeky-as-I-am skillset can declare processing tasks.

    Read the article

  • Scheme define/lambda shorthand

    - by incrediman
    In Scheme, how can I make use of the define/lambda shorthand for nested lambda expressions within my define? For example given the following procedure... (define add (lambda (num1 num2) (+ num1 num2))) One can shorten it to this: (define (add num1 num2) (+ num1 num2)) However, how can I shorten the following function similarly ? (define makeOperator (lambda (operator) (lambda (num1 num2) (operator num1 num2)))) ;example useage - equivalent to (* 3 4): ((makeOperator *) 3 4)

    Read the article

1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >